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

A South Carolina man was arrested in connection with planning a violent white supremacist attack "in the spirit of Dylann Roof," the FBI said in a complaint Thursday.

Benjamin Thomas Samuel McDowell, 29, became known to federal agents after a series of Facebook posts were flagged in which he made threats and professed violent white supremacist ideologies, said Special Agent Grant Lowe of the FBI's office in Columbia.

Benjamin McDowell is charged with being a felon in possession of a firearm. Horry County Sheriff's Office via AP

McDowell, also known as Benji, met with an undercover FBI agent on Wednesday to purchase a gun at the parking lot of a Myrtle Beach Hampton Inn. He was arrested and charged with possession of a firearm, which is illegal due to his pre-existing status as a felon on unrelated charges.

The arrest came after several weeks of tracking and interacting with McDowell, the FBI said.

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

McDowell began posting on Facebook about a Myrtle Beach synagogue in late December, the complaint said. On Jan. 5, the feds say, he wrote a long, misspelled rant about Jews, the "white race" and Roof, who was found guilty in December of murdering nine black worshipers at a Charleston church in 2015.

McDowell also appeared to reference an early January video that showed four young black people beating a disabled white teen that was streamed on Facebook Live.

Related: Huge Growth in Anti-Muslim Hate Groups During 2016: SPLC Report

Soon after his post, Lowe said, McDowell contacted an undercover FBI agent that he believed “handled problems for the Aryan Nations.” In an instant message on Facebook, McDowell requested an “iron,” a code word for a firearm, the complaint against him said.

The agent, who is not identified by name in the testimony, said that McDowell complained about other white supremacists, “stating that screaming ‘white power’ was not getting the job done.’”

He allegedly expressed a desire to commit a terrorist act, telling the undercover agent: “I seen what Dylann Roof did and in my heart I reckon I got a little bit of hatred ... I want to do that sh*t.”

During ongoing communication with the undercover agent, the testimony said, it was revealed that McDowell was talking on his mother’s landline and cellphone. The agent also allegedly agreed to pick McDowell up at his mother’s house, then drive to his grandfather’s home where he planned to borrow money to buy the gun.

McDowell was a known white supremacy extremist who had connected with white power gangs while serving time in prison, and had tattoos that indicated the affiliation, according to the Horry County Police Department.

NBC affiliate WFMB reported Thursday that McDowell’s police records show he has been arrested seven times in the past decade in South Carolina alone. The charges included malicious injury to animals, assault, violent second-degree burglary, littering, possession of marijuana, and a third-degree burglary for which McDowell served three years in prison, according to the station.

McDowell's next court date was set for Tuesday.