Authorities have captured Dylann Storm Roof, the suspected terrorist in an attack on a black South Carolina church.

Federal authorities confirmed the 21-year-old was wanted in the Wednesday night shooting that left nine worshipers dead after a prayer service at Emanuel African Methodist Episcopal Church in Charleston.

The Eastover, South Carolina, man was arrested in late February in Columbia after security guards reported him dressed in all black and acting strangely at the Columbiana Mall.

ADVERTISEMENT

Officers said they found several strips of Suboxone, which is used to treat addiction to heroin and painkillers, on Roof after he consented to a search.

He was banned from the mall, but he was arrested April 26 for trespassing after returning there.

Roof was apprehended about 11 a.m. Thursday after a motorist spotted his black Hyundai Elantra, which displays a “Confederate States of America” license plate on the front bumper, while driving near Shelby, North Carolina.

An uncle said Roof received a gun from his father for a birthday present in April.

ADVERTISEMENT

“The more I look at him, the more I’m convinced that’s him,” his uncle, 56-year-old Carson Cowles, told Reuters.

Roof’s Facebook profile reveals little about him, but he is wearing a jacket with patches flags from the white rule-eras of South Africa and Rhodesia, which is now Zimbabwe.

He is friends with 89 people on the social network, about a third of whom are black.

ADVERTISEMENT

A high school friend told The Daily Beast that he recalled Roof as a heavy drug user.

“He used drugs heavily a lot,” said classmate John Mullins. “It obviously harder than marijuana. He was like a pill popper, from what I understood. Like Xanax, and stuff like that.”

ADVERTISEMENT

The classmate said Roof’s racism seemed unremarkable to him before he allegedly gunned down nine black people inside their church.

“I never heard him say anything, but just he had that kind of Southern pride, I guess some would say — strong conservative beliefs,” he said. “He made a lot of racist jokes, but you don’t really take them seriously like that. You don’t really think of it like that.”

A survivor said the gunman stood up and announced that he was there to shoot black people.

ADVERTISEMENT

“I have to do it,” the terrorist said, according to a survivor. “You rape our women and you’re taking over our country — and you have to go.”