A South Carolina man with connections to a white supremacy group was arrested Wednesday for allegedly planning an attack "in the spirit of Dylann Roof."

Benjamin McDowell, 29, was arrested after purchasing a .40 caliber Glock handgun and ammunition from an undercover FBI agent, according to a federal complaint.

The Horry County police department alerted the FBI that McDowell had White Supremacy Extremist connections from time he had spent in prison. The 29-year-old also had tattoos indicating affiliation with the extremist groups, according to the complaint.

In December 2016 and January 2017, McDowell allegedly posted messages on Facebook — often times targeting his hatred toward Jews, and in one instance threatening a synagogue.

On Jan. 5, McDowell posted, "All they wanne do is stay loaded on drugs the Jews put here to destory white man and they fest on the drugs,” [sic] according to the complaint.

In that same post, McDowell praised Roof, who was sentenced to death for fatally shooting nine people at the Emanuel AME Church in Charleston in June 2015.