In the hours after the Charleston shooting bloodbath, a portrait began to take shape of suspect Dylann Roof as someone with racist views and at least two recent run-ins with the law.
In recent weeks he reconnected with a childhood friend he had not seen in five years and started railing about the Trayvon Martin shooting case, black people "taking over the world" and the need for someone to do something about it for the sake of "the white race".
On his Facebook page, the young white man wore a jacket with the flags of the former white-racist regimes of South Africa and Rhodesia.
Joey Meek said he and Roof had been best friends in middle school but lost touch when Roof moved away about five years ago. The two reconnected a few weeks ago after Roof reached out to Mr Meek on Facebook, Mr Meek said.
Roof never talked about race years ago when they were friends, but recently made remarks out of the blue about the killing of unarmed black 17-year-old Trayvon Martin in Florida and the riots in Baltimore over the death of Freddie Gray in police custody.
"He said blacks were taking over the world. Someone needed to do something about it for the white race," Mr Meek said, adding that the friends were getting drunk on vodka. "He said he wanted segregation between whites and blacks. I said, 'That's not the way it should be'. But he kept talking about it."
The Southern Poverty Law Centre, a civil rights group that tracks hate organisations and extremists, said it was not aware of Roof before the rampage. And some other friends interviewed said they did not know him to be racist.
"I never thought he'd do something like this," said high school friend Antonio Metze, 19, who is black. "He had black friends."
Roof used to skateboard while growing up in the Lexington area and had long hair back then. He attended high school in Lexington and in nearby Columbia from 2008 to 2010, school officials said. It was not immediately clear whether he graduated.
"He was pretty smart," Mr Metze said.
Mr Meek's mother Kimberly Konzny said she and her son instantly recognised Roof in the surveillance camera image because Roof had the same stained sweatshirt he wore while playing Xbox video games in their home recently. It was stained because he had worked at a landscaping and pest control business, she said.
"I don't know what was going through his head," she said. "He was a really sweet kid. He was quiet. He only had a few friends."
Mr Meek said Roof's mother and her boyfriend live in Lexington and his father lives in Columbia.
Roof displayed a Confederate flag on his car registration plate, according to Ms Konzny, but that is not unusual in the South.
His Facebook profile picture showed him wearing a jacket with a green-and-white flag patch, the emblem of white-ruled Rhodesia, the African country that became Zimbabwe in 1980. Another patch showed the South African flag from the era of white minority rule that ended in the 1990s.
In Montgomery, Alabama, the president of the Southern Poverty Law Centre, Richard Cohen, said it was unclear whether Roof had any connection to any of the 16 white supremacist organisations the SPLC has identified as operating in South Carolina.
But Mr Cohen said that based on Roof's Facebook page, he appeared to be a "disaffected white supremacist".
Mr Cohen said the church attack was a reminder that while the post-September 11 US is focused on jihadi terrorism, the threat of home-grown extremism was "very real". Since 2000, the SPLC has seen an increase in the number of hate groups in the US, he said.
"The increase has been driven by a backlash to the country's increasing racial diversity, an increase symbolised for many by the presence of an African American in the White House," he said.