A 21-year-old man suspected of killing nine people at a historic African-American church in Charleston, South Carolina, has been arrested.
Police said Dylann Roof, of Lexington, South Carolina, was detained during a traffic stop in Shelby, North Carolina.
The gunman is reported to have sat in on a Bible study meeting for a full hour before opening fire on the group.
Six women and three men, including the church pastor, were killed. A hate crimes investigation has been launched.
US President Barack Obama said he and his wife had known several members of the Emanuel AME Church, including the pastor, Clementa Pinckney.
He called the church a “sacred place” in the history of Charleston and spoke of his confidence that the congregation and the community would “rise again”.
He also raised the issue of gun ownership, saying: “At some point, we as a country have to reckon with the fact that this type of massacre does not happen in other advanced countries”.
A major manhunt was launched after the shooting at the weekly Bible study meeting in the church on Calhoun Street on Wednesday evening.
The police chief in Shelby said Dylann Roof was arrested after a tip off from a local business.
Shortly afterwards, officers spotted Mr Roof’s car and stopped it, Chief Jeff Ledford was quoted by the Associated Press as saying.
Mr Roof was said to have been cooperative during his arrest.
In a brief court appearance on Thursday, he waived his right to extradition and was placed on an aeroplane that will take him back to South Carolina.
The study group is said to have believed the gunman wanted to join them in studying the Bible. He stayed nearly an hour before becoming aggressive and violent, Charleston’s county coroner said.
Eight people died at the scene and one person died later in hospital. There were three survivors.
Along with Rev Pinckney, a 41-year-old father of two, the other victims have been named as Cynthia Hurd, 54; Tywanza Sanders, 26; Sharonda Singleton, 45; Myra Thompson, 59; Ethel Lance, 70; Susie Jackson, 87; the Rev Daniel Simmons Sr, 74; and DePayne Doctor.
What do the flags on Dylann Roof’s jacket symbolise?
An image found on Dylann Roof’s Facebook page shows the Charleston shooting suspect posing for the camera in a black jacket with two flags stitched to it.
The flags are both old – one belonged to apartheid-era South Africa and the other to the state of Rhodesia, now Zimbabwe.
Rhodesia became Zimbabwe in 1980 and South Africa rejected apartheid in 1994 – the year Mr Roof was born. But during the time they flew the flags worn by him, both nations were segregated and ruled by white minorities.
White supremacist organisations have celebrated both nations, claiming them to be examples of the benefits of white rule. The flags can be a subtle way for a white supremacist to reveal support for their cause, analysts say.
Police and officials were quick to call it a hate crime, and the US Department of Justice said it would open a federal hate crimes investigation.
Speaking after the arrest, Attorney General Loretta Lynch said prosecutors would be “looking at all of the facts, all of the motivations” to determine the best way to proceed.
Charleston has a reputation for being a friendly Southern city, but it also has a history associated with the slave trade and the civil rights movement, says the BBC’s Rajini Vaidyanathan.
The Emanuel church is firmly part of that history, being the oldest African Methodist Episcopal (AME) church in the US south. Civil rights leader Martin Luther King gave a speech there in April 1962.
Some local residents have told our correspondent that although this shooting appears to be an isolated incident carried out by one man, there are deeper racial tensions in this city.
Many black people live here, but few hold positions of power, she notes.
Tensions have been heightened since the shooting two months ago of Walter Scott, an unarmed black man by a white police officer in North Charleston, which prompted angry protests. The officer has since been charged with murder.
Clementa Pinckney, the 42-year-old pastor of the church, was also a Democratic state senator in South Carolina.
He had recently sponsored a bill to make body cameras mandatory for all police officers in South Carolina in response to the death of Walter Scott.