An Albanian man who became a U.S. citizen but carried an Islamic State flag has pleaded guilty to terrorism charges.

Sajmir Alimehmeti entered the plea Wednesday in Manhattan federal court to an indictment alleging he provided material support to the group.

His trial had been scheduled to begin in May. Sentencing is set for June 7.

The 24-year-old Alimehmeti was living in the Bronx before his May 2016 arrest. Investigators say two undercover officers and an undercover FBI employee posing as an Islamic State supporter began gathering evidence in September 2015.

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.