Charleston: A 21-year-old white man suspected of killing nine people at a historic African-American church in Charleston, South Carolina was arrested on Thursday after an attack that the United States is investigating as a hate crime.

Law enforcement officials arrested alleged gunman Dylann Roof after a traffic stop in Shelby, North Carolina, about 220 miles (350km) north of Charleston, said police chief Gregory Mullen.

“This individual committed a tragic, heinous crime last night,” Mullen told reporters.

The mass shooting on Wednesday followed months of racially charged protests over killings of black men which have shaken the United States.

US Attorney General Loretta Lynch said her office was investigating whether to charge Roof with a hate crime motivated by racial or other prejudice. Such crimes typically carry harsher penalties.

“The fact that this took place in a black church obviously raises questions about a dark part of our history,” US

President Barack Obama told reporters. “We don’t have all the facts but we know that, once again, innocent people were killed in part because someone who wanted to inflict harm had no trouble getting their hands on a gun.” The Southern Poverty Law Center, which researches US hate groups, said the attack illustrates the dangers that home-grown extremists pose.

“Since 9/11, our country has been fixated on the threat of Jihadi terrorism. But the horrific tragedy at the Emanuel AME reminds us that the threat of home-grown domestic terrorism is very real,” the group said in a statement, referring to the Sept. 11, 2001 attacks on the United States.

A man who identified himself as Roof’s uncle earlier told Reuters Roof’s father had recently given him a .45-calibre handgun as a birthday present and that Roof had seemed adrift.

“I don’t have any words for it,” the uncle, Carson Cowles, 56, said in a telephone interview. “Nobody in my family had seen anything like this coming.” The victims, six females and three males, included Reverend Clementa Pinckney, who was the church’s pastor and a Democratic member of the state Senate, according to colleagues.

Roof sat with churchgoers inside Emanuel African Methodist Episcopal Church for about an hour on Wednesday before opening fire, Mullen said, adding that police believe Roof acted alone.

Demonstrations have rocked New York, Baltimore, Ferguson, Missouri and other cities following police killings of unarmed black men including Eric Garner, Freddie Gray and Michael Brown.

A white police officer was charged with murder after he shot Walter Scott, an unarmed black man, in April in neighbouring North Charleston.

‘A LOT OF CONCERN’ The local community reacted with shock and grief after Wednesday’s mass shooting.

“This is going to put a lot of concern to every black church when guys have to worry about getting shot in the church,” said Tamika Brown while waiting for a noon prayer vigil at an AME church near the site of the shooting.

“They might need security guards, police officers.” Eight victims were found dead in the church, Mullen said, and a ninth died after being taken to hospital. Three people survived the attack. Officials did not immediately identify the other victims.

Roof was charged on two separate occasions earlier this year with a drug offence and trespassing, according to court documents. In a Facebook profile apparently belonging to him, he is pictured wearing a jacket prominently featuring the flags of apartheid-era South Africa and Rhodesia, now Zimbabwe, from when the two African countries were ruled by their white minorities.

Roof’s mother, Amy, declined to comment when reached by phone. “We will be doing no interviews, ever,” she said before hanging up.

The shooter told one survivor he would let her live so she could tell others what happened, the president of the Charleston NAACP, Dot Scott, told the local Post and Courier newspaper.

A cousin of Pinckney’s, Sylvia Johnson, told MSNBC that a survivor of the shooting told her the gunman reloaded five times during the attack during a Bible-study group. Pinckney tried to talk him out of it, she said.

“He just said, ‘I have to do it. You rape our women and you’re taking over our country,” Johnson said.

“It is a very, very sad day in South Carolina, but it is a day that we will get through,” Governor Nikki Haley, a Republican, told reporters. “Parents are having to explain to their kids how they can go to church and feel safe, and that’s not something we ever thought we’d deal with.”