Authorities have arrested a Bronx man on charges that he supported and tried to join ISIS.

Sajmir Alimehmeti, 22, was taken into custody early on Tuesday and charged with providing material support to a terrorist organization, NBC4 reported. He was alleged to have helped an undercover agent whom he thought wanted to fight with ISIS by agreeing to buy supplies and showing the agent how to use encryption technology.

RELATED: Bronx single dad left young son to fight ISIS

After meeting the undercover agent that Alimehmeti believed to be an ISIS sympathizer, he invited the agent to his apartment where the duo watched decapitation videos that Alimehmeti said served as motivation while he was exercising, the New York Daily News reported.

Besides keeping an ISIS flag in his Norwood apartment, sources told NBC4 that Alimehmeti also allegedly purchased weapons, handcuffs and masks.

On two occasions, Alimehmeti attempted to travel to the Middle East but was stopped both times by British authorities who found camouflage clothing, nunchucks and pro-ISIS photos on his cellphone and laptop, the Daily News stated. British authorities alerted the FBI of their findings when Alimehmeti was sent back to the U.S.

RELATED: Ex-captive: Top ISIS commander is an American

Alimehmeti was scheduled to appear in federal court in Manhattan on Tuesday, according to ABC7.