US police on Thursday arrested a 21-year-old white gunman suspected of killing nine people at a prayer meeting in one of the nation's oldest black churches in Charleston, an attack being probed as a hate crime.
The shooting at the Emanuel African Methodist Episcopal Church in the southeastern US city was one of the worst attacks on a place of worship in the country in recent years, and comes at a time of lingering racial tensions.
The suspect — identified as Dylann Roof of Columbia, South Carolina — was taken into custody in neighboring North Carolina, about a four-hour drive from the scene of the shooting, Charleston Police Chief Gregory Mullen said.
"I do believe it was a hate crime," Mullen said.
Detectives were headed to Shelby, North Carolina — where Roof was apprehended during a traffic stop — to interview the suspect and gather evidence, he told reporters.
Churchgoers had gathered Wednesday evening when the shooter walked into the building, sat in the congregation for about an hour and then opened fire, Mullen said.
Three men and six women were killed, and several other people were wounded. Among the dead was the church's pastor Clementa Pinckney, who was also a Democratic state senator.
Roof — a slender white man with dark blond or brown hair in a distinctive bowl-type haircut and wearing a grey sweater — had been described by police as "extremely dangerous."
A picture on Roof's Facebook page showed him wearing a black jacket with patches of the apartheid-era South African flag and the flag of white-ruled Rhodesia, which is now Zimbabwe.
The shooting comes at a time of heightened racial tensions in America, after several high-profile killings of unarmed black men at the hands of white police in recent months led to protests and a national debate on race.
President Barack Obama was due to make a statement about the shooting.
A Justice Department spokesperson said a hate crimes probe had been opened, with FBI agents working in tandem in with local police.
"The heart and soul of South Carolina was broken," a tearful state Governor Nikki Haley said.
Jim Curley, owner of AC's Bar & Grill, which is located a few blocks from the church, said locals were shocked anyone would carry out an attack in the popular tourist area.
"This is absolutely bizarre," Curley told AFP. "This is really completely out of the blue... We have no idea what the motivation is."
The incident once again highlights broad racial tensions that persist in many US communities, more than five decades after the Civil Rights Act outlawed racial and other forms of discrimination.
In April, in the neighboring city of North Charleston, a white police officer was charged after a video surfaced of him fatally shooting a fleeing black man in the back after a traffic stop.
But Curley said the neighborhood's residents typically get along fine.
"Generally, there's not a great deal of racial tension," he said.
Charleston is known locally as "The Holy City," due to its large number of churches and historical mix of immigrant ethnic groups that brought a variety of creeds to the city on the Atlantic coast.
"In this great country, we hold sacred the places where people come and practice their faiths in safety and in peace," Mayor Joseph Riley said.
Dot Scott, the head of the local chapter of the National Association for the Advancement of Colored People (NAACP), said the shooter may not have drawn attention because of the church's location.
"It sits in an area that a lot of the tourists frequent. It's not out of the ordinary that folks just walk into the sanctuary and sit and listen to what's going on," Scott told CNN.
Officials did not release detailed information about the victims, or say what kind of gun was used.
According to its website, the Emanuel African Methodist Episcopal Church is the oldest such church in America's southern states.
The church was founded in 1816 and in 1822 was investigated for its involvement with a planned slave revolt, the website states.
"The only reason someone can walk into church and shoot people praying is out of hate," Riley said. "It is the most dastardly act that one can possibly imagine."
Republican presidential candidate Jeb Bush canceled campaign events that had been planned for Thursday in Charleston.
"Heartbreaking news from Charleston - my thoughts and prayers are with you all," tweeted Democratic presidential candidate Hillary Clinton, who had been in Charleston earlier Wednesday.
The Charleston shooting is the latest on a long list of mass shootings in the United States.
The deadliest in recent years include the April 2007 Virginia Tech shooting, when 32 were killed, and the December 2012 Sandy Hook elementary school shootings in Newtown, Connecticut, when a total of 27 people died, including 20 children.
In August 2012, six people were shot dead at a Sikh temple in Wisconsin by a neo-Nazi US military veteran.
Charleston is famous for its cobblestone streets, Southern cuisine and nearby beaches and islands. The city is also known outside the United States for its namesake 1920s dance.