NEW YORK (AP) — An Albanian turned U.S. citizen who kept an Islamic State group flag in his apartment was sentenced to 22 years in prison Friday after pleading guilty to terror charges.

Sajmir Alimehmeti, 26, of the Bronx was sentenced Friday by U.S. District Judge Paul A. Engelmayer, who called him a “ticking time bomb.” He called his conduct “terrifying.”

In February 2018, he admitted providing material support to the group.

A onetime plumbing assistant who had studied funeral services, Alimehmeti was arrested in May 2016 on evidence assembled over eight months by two undercover New York City police officers and an undercover FBI employee posing as Islamic State group recruits.

Authorities said Alimehmeti began collecting weapons such as combat knives that could be used in a “lone-wolf” style terrorist attack.

Arresting agents reported recovering terrorist propaganda, the flag and images of jihadist fighters.

U.S. Attorney Geoffrey S. Berman said in a release that Alimehmeti had traveled overseas to support the Islamic State group’s terror campaign by buying military-grade weapons and helping another recruit get travel documents, equipment and encryption technology to fight with the group in Syria.

“Even after his incarceration, Alimehmeti continued his supportive conduct for ISIS by working with convicted Chelsea bomber Ahmad Khan Rahimi, to distribute ISIS propaganda in prison,” Berman said.