Here is a timeline of what happened:
WEDNESDAY, AROUND 8 p.m.
Police said the alleged gunman, identified Thursday as Dylann Roof, was attending a bible study group with other worshipers at the predominantly black Emanuel AME Church.
WEDNESDAY, 9:05 p.m.
After spending almost an hour with the group, the suspect stood up and started shooting.
Nine people were killed, including Rev. Clementa Pinckney -- a church pastor and a South Carolina state senator. Six other victims were identified as Rev. Sharonda Singleton, retired pastor Dr. Daniel L. Simmons, Ethel Lee Lance, Cynthia Hurd, Myra Thompson and recent college graduate Tywanza Sanders. Police said three of the victims were men and six women. Their ages were unclear.
Some people did survive, but their identities have not been released.
"It is senseless," Charleston police Chief Greg Mullen said. "It is unfathomable that somebody would walk into a church when people are having a prayer meeting and take their lives."
Early this morning, police released pictures from surveillance footage showing the suspect as well as the car he was driving, police said.
Officials then identified the alleged gunman as 21-year-old Dylann Roof.
"This is an extremely dangerous individual," Mullen said.
THURSDAY, 10:32 a.m.
At 10:32 a.m., police in Shelby, North Carolina,said they were informed "that a business had contacted them of a possible sighting of the suspect from the Charleston, South Carolina, church shooting traveling into Shelby."
THURSDAY, 10:44 a.m.
At 10:44 a.m., Roof was apprehended at a traffic stop in Shelby, police said. He was taken into custody 5 minutes later.
A citizen saw the suspect’s car and reported it to police, who responded and made the arrest, police said. Roof cooperated with the officer who stopped him, according to police.
Officials said they believe Roof acted alone.
"I am so pleased we were able to resolve this case quickly," Chief Mullen said at a news conference.
A prayer service was held at noon today at the Morris Brown AME Church in Charleston.
A court clerk confirmed to ABC News this afternoon that Roof waived extradition in North Carolina and is cleared to return to South Carolina.