A recently released felon who was radicalized in prison and expressed support for the Islamic State has been charged with illegally acquiring a firearm, the U.S. Attorney’s Office in Alexandria said Friday.

Casey Charles Spain, 28, of Richmond, was arrested Thursday after receiving a disabled semiautomatic handgun from a source in a sting set up by the FBI, according to court records.

Spain was released from the Greensville Correctional Center in Jarratt, Va., on Aug. 11 after serving seven years for a 2010 conviction for abduction with intent to defile. He also has a previous conviction for malicious wounding.

The FBI had Spain under intense surveillance after his release because he told informants in prison that he had sworn allegiance to the leader of the Islamic State, Abu Bakr al-Baghdadi, and expressed interest in obtaining a firearm and traveling overseas to support the organization, according to a criminal complaint.

If he wasn’t allowed to travel after his release, Spain told the informants, he would engage in jihad, including by attacking targets in the United States, the complaint says.

Casey Charles Spain, 28. (AP/Virginia Sex Offender Registry/AP)

While incarcerated, Spain got a tattoo that read “Cop Killa” on his cheek, as well as one of the Islamic State flag on his back.

The FBI made contact with Spain after prison through undercover agents and a confidential source, who met Spain on Aug. 19, the complaint says.

Spain told the source on multiple occasions about his desire to help the Islamic State and obtain a handgun, the complaint says. He made similar comments to prisoners who were still incarcerated in conversations recorded by the FBI and told prisoners he had conversations with Islamic State members overseas, according to court documents.

In addition to helping the Islamic State, Spain told the source he wanted a gun so he could kill police officers if they ever tried to arrest him, the complaint says. Spain intimated to the source that he didn’t want to go back to prison because it would interfere with his plans to help the Islamic State, the complaint says.

The confidential source also told authorities Spain had no interest in making friends or finding a girlfriend; instead he talked almost exclusively about joining the Islamic State, according to the complaint.

On Tuesday, an undercover agent discussed plans with Spain to sell him a gun via messages exchanged through a cellphone messaging application, the complaint says. The next day, Spain told the confidential source and another undercover agent that he had made arrangements to buy a handgun with a 50-round barrel canister from someone online, the complaint says.

At that point, the FBI decided to set up the sting because of Spain’s violent history and eagerness to acquire a gun, the complaint says. Shortly before 3 a.m. Thursday, the confidential source and an undercover FBI agent met Spain outside his home and gave him the handgun, the complaint says.

Following a short chase, an FBI SWAT team took Spain into custody. He has been charged with possession of a firearm by a felon. He faces a maximum penalty of 10 years if convicted.

Spain is being held without bond.