Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Dylann Roof, the man accused of gunning down nine parishioners at a historically black church in Charleston, was charged on Friday with nine counts of murder and illegal weapons possession, police said.

Roof, 21, confessed on Thursday to perpetrating the horrific attack at Emanuel African Methodist Episcopal Church in downtown Charleston, two sources confirmed to NBC News.

Roof told police that he "almost didn't go through with it because everyone was so nice to him," sources told NBC News — but he decided he had to "go through with his mission."

Police lead suspected shooter Dylann Roof into the courthouse in Shelby, North Carolina, June 18, 2015. JASON MICZEK / Reuters

Roof was captured in Shelby, North Carolina, on Thursday morning during a traffic stop. He agreed to be taken back to South Carolina.

He was being held Friday at the Al Cannon Detention Center in North Charleston. A sheriff's spokesman told NBC News that Roof's cell at the detention facility neighbored that of Michael Slager, the white South Carolina officer charged with murder for shooting Walter Scott, an unarmed black man.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Police have called the killings a hate crime, and the Justice Department will open a civil rights investigation that will parallel the state probe.

RELATED: Victim's Son Forgives Charleston Church Gunman

South Carolina Gov. Nikki Haley told TODAY that she believes Roof committed a hate crime and should pay the ultimate price.

"We will absolutely want him to have the death penalty," Haley said.

Roof was among a dozen church members who were attending a Bible study at Emanuel AME, one of the nation’s oldest African-American churches. He asked to sit next to the pastor, and about an hour into the meeting, opened fire on the people there. He killed six women and three men, including the pastor, the Rev. Clementa Pinckney, police said. Three people survived.

One survivor told a relative of Pinckney’s that during the rampage the gunman said that African-Americans are "taking over our country.”

Charleston County Coroner Rae Wilson said Thursday that the gunman walked into the church and didn’t raise any red flags among the worshipers.

"The suspect entered the group and was accepted by them, as they believed that he wanted to join them in this Bible study," she said. Then, "he became very aggressive and violent."

RELATED: Drugs, Trespassing, Racism: Who Is Dylann Roof?

Roof had two prior arrests earlier this year after he was stopped at a Columbia shopping mall and was found with Suboxone, a type of narcotic used to treat opiate addictions, police reports show. He was taken into custody on a drug charge, and then again the following month for trespassing at the mall.

Roof’s uncle told Reuters that he had received a .45-caliber handgun from his father for his birthday in April, but officials have not said how he got the firearm used in the shooting or its make.

Gallery: South Carolina in Shock After Shootings