A Missouri man accused of plotting a terrorist attack with who he believed to be members of the Islamic State but who were in reality undercover FBI agents was sentenced Wednesday to 19 years in prison.

Robert Lorenzo Hester Jr., 28, of Columbia, pleaded guilty in September to attempting to provide material support to the terror group from October 2016 to February 2017, the Justice Department said.

Prosecutors said Hester advocated violence on social media and was contacted by the undercover agents who posed as ISIS operatives. He said he was willing to assist ina jihadist attack.

He posted on social media that he had converted to Islam and posted photos of weapons and the ISIS flag. According to a criminal complaint, Hester was told the attack would target "buses, trains and a train station in Kansas City" on the Presidents Day holiday.

LINDSEY GRAHAM ON US-TALIBAN PEACE AGREEMENT: 'LET'S GIVE IT A TRY'

According to the affidavit, Hester "expressed approval" of the attack plan and told an undercover agent that it would be "good to strike back at the true terrorist."

Hester, a U.S. citizen, joined the Army in 2012 and received a general discharge less than a year after enlisting after violating multiple Army regulations. In his communications with the undercover agents, he cited his military training and claimed "proficiency with 'assault weapons.'"

CLICK HERE TO GET THE FOX NEWS APP

He identified potential targets for an attack, including “oil production,” “military bases,” “federal places,” “government officials,” and “Wall Street," the DOJ said.

After his serving his time, Hester will be subject to a lifetime of supervised release.