A Missouri man was sentenced to nearly 20 years in prison on Wednesday for his efforts to assist in what he believed was a mass-casualty terrorist attack directed by ISIS.

Robert Lorenzo Hester, Jr., 28, of Columbia, was charged with two counts of providing material support to terrorists in February 2017. He pleaded guilty to one count of the indictment last September as the case proceeded in exchange for a dismissal of the other count, which cut the potential term of imprisonment in half.

In fall 2016 and early 2017, Hester carried on a relationship with several undercover FBI agents, believing they were affiliated with ISIS, the terrorist organization based in Syria whose territorial claims have been vastly reduced in recent years.

For a period of months, he was sent on errands to purchase materials such as roofing nails and duct tape that were purportedly intended for use in a large-scale terrorist attack.

Hester, a discharged U.S. Army recruit who converted to Islam, conversed frequently with the undercover agents about potential targetsnoting especially “the perceived ease in which one could gain access to a military base,” according to an affidavit from FBI Special Agent Patrick T. Casey.

Ultimately, an attack on public transportation was considered before the undercover operation concluded, resulting in Hester’s arrest in February 2017.

His attorney’s did not respond to a request for comment.

Hester’s observations in fall 2016 that military bases pose easy targets for attacknoting particularly that gaining access is manageable as “long as [you] have state ID”presages recent, high-profile assaults on military bases that have led some officials to reconsider restrictive concealed carry policies.

Last December, a second lieutenant in the Royal Saudi Air Force opened fire at the Naval Air Station Pensacola in Florida, killing three people. He had been credentialed to access the base as part of an aviation training program for foreign nationals.

A subsequent investigation into the killings resulted in the expulsion of nearly two dozen Saudi trainees for unrelated offenses.

Just two days earlier, a sailor killed two Defense Department employees at the Pearl Harbor Naval Shipyard in Hawaii.

On New Year’s Eve, the Marine Corps issued a directive announcing that personal concealed carry firearmswhich are generally prohibited on military installationscould be afforded to credentialed Marine Corps police while off duty.

A sentencing memorandum filed in Hester’s case argues that his unceremonious departure from the militaryan honorable discharge resulting from his “lack of aptitude” and alcohol usehelped make him susceptible to jihadist recruitment.

He felt “emotionally betrayed by the Army and struggled to handle the humiliation he received in his home community for ‘flunking out’ of the military,” his attorney said in a sentencing memorandum.

Court filings also describe an abusive childhood, where Hester’s parents mistreated and neglected him.

“Throughout all of his struggles, Robert Hester desperately wanted to feel accepted and to do something that would make someone proud of him,” the memorandum said. “In an effort to fit in, he searched online to learn how to be a good, new Muslim. Robert Hester quickly ran into targeted propaganda that was aimed directly at young, disaffected men like himself.”