This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

CHARLESTON, S.C. — Dylann Roof has confessed to authorities to shooting and killing nine people this week at a historically black church in Charleston, South Carolina, two law enforcement officials said Friday.

One of the officials said that Roof, who is white, told investigators that he wanted to start a race war.

He himself bought the .45-caliber handgun used in the shooting last April at a Charleston gun store, according to the two officials. Earlier, a senior law enforcement official had indicated that Roof’s father bought him a Glock firearm for his birthday.

Shortly after he turned 21 in April, Dylann Roof got a gun. What’s unclear is how.

What may be getting clearer is why.

A senior law enforcement official briefed on the investigation told CNN that Roof’s father bought him a .45-caliber Glock handgun for his birthday.

His grandfather says Roof was given “birthday money” and that the family didn’t know what Roof did with it.

However he got the gun, police say it was Roof, a white man, who opened fire at a prayer meeting at Emanuel African Methodist Episcopal Church in Charleston, South Carolina, killing nine African-Americans.

It’s not known whether that handgun was used when Roof allegedly opened fire Wednesday night.

But as he awaits a bond hearing possibly Friday, that’s one of the many threads investigators are pursuing.

The question of why

The other thread is why.

It’s not so much why Roof allegedly did what he did. Authorities say he apparently was motivated by hate, telling the African-American congregants, “You rape our women, and you’re taking over our country.”

It’s more how the shooting came to be, and the events that precipitated it.

Roof’s roommate, Joey Meek, told ABC News that Roof “was big into segregation,” and was plotting for six months.

“I think he wanted something big like Trayvon Martin,” Meek told the network. “He wanted to make something spark up the race war again.”

But Meek never alerted authorities.

A tip, an arrest

Roof was arrested Thursday morning about 245 miles (395 kilometers) away in Shelby, North Carolina. He waived extradition and arrived back in South Carolina late Thursday.

Police got a tip from Debbie Dills, who reportedly spotted Roof on her way into work. She followed him for 35 miles.

“I don’t know what drew my attention to the car,” she told CNN.

She saw it had a South Carolina license plate. “In my mind I’m thinking, ‘That can’t be.’ … I never dreamed that it would be the car.”

Dills followed Roof for more than 30 miles, keeping authorities updated along the way.

Shelby police eventually caught up with Roof, pulled him over and took him into custody before returning him to Charleston.

The attack

Before he allegedly opened fire at the church Wednesday night, Roof sat with them. He might have prayed with them.

A Snapchat video from Wednesday night at the historic African-American church shows Roof at a table with the small group. Nothing in the footage suggests the carnage to come.

Six women and three men were killed, including the church’s politically active pastor, the Rev. Clementa Pinckney.

Sylvia Johnson, a cousin of Pinckney, said she heard about what happened inside the church from a survivor, a close friend.

Johnson told CNN her friend recounted the man coming into the church, asking for the minister.

“My cousin, being the nice, kind, welcoming person he is, he welcomed him to his congregation, welcomed him to the Bible study, and he sat there for an hour … At the conclusion of the Bible study, they just heard just a ringing of a loud noise, and it was just awful from what I heard,” Johnson said.

When the son of her friend pleaded with the shooter to stop, Johnson said the gunman replied: “‘No, you’ve raped our women, and you are taking over the country … I have to do what I have to do.’ And he shot the young man.”

A deadly scene

Her friend pretended she was dead.

“But she watched her son fall and laid there. She laid there in his blood,” Johnson said.

From what she heard, the gunman reloaded five times.

Before he left the church, he asked one of the elderly members whether he had shot her, and she said no.

“And he said good, because we need a survivor because I’m going to kill myself,” Johnson told CNN.

A law enforcement official said witnesses told authorities the gunman stood up and said he was there “to shoot black people.”

Connection to hate groups

Police are now trying to determine whether Roof had any links to hate groups.

Authorities released a mug shot of him from Lexington County on Thursday. It was taken after a trespassing arrest in April. According to an arrest warrant from a February incident, Roof had an unlabeled pill bottle with a drug believed to be suboxone, which is used to treat opiate addiction. Roof told police a friend gave him drugs. The status of the cases is unclear.

In an image tweeted by the Berkeley County, South Carolina, government, Roof is wearing a jacket with what appear to be the flags of apartheid-era South Africa and nearby Rhodesia, a former British colony that was ruled by a white minority until it became independent in 1980 and changed its name to Zimbabwe.

The victims

Charleston County Coroner Rae Wooten identified the nine victims as follows: Cynthia Hurd, 54; Susie Jackson, 87; Ethel Lance, 70; Rev. DePayne Middleton-Doctor, 49; Hon. Rev. Clementa Pinckney, 41; Tywanza Sanders, 26; Rev. Daniel Simmons Sr., 74; Rev. Sharonda Singleton, 45; Myra Thompson, 59.

Wooten told reporters that the victims all suffered gunshot wounds and died as a result of them.

Three people survived the shooting, including a woman who received a chilling message from the shooter.

“Her life was spared, and (she was) told, ‘I’m not going to kill you, I’m going to spare you, so you can tell them what happened,’ ” Charleston NAACP President Dot Scott told CNN. She said she heard this from the victim’s family members.

Hate crime investigation

Federal authorities have opened a hate crime investigation into the shooting at the oldest AME church in the South, the Department of Justice said.

“The only reason someone would walk into a church and shoot people that were praying is hate,” Charleston Mayor Riley said.

It was not clear if the gunman targeted any individual.

“We don’t know if anybody was targeted other than the church itself,” Charleston police Chief Greg Mullen said.