A Waterville teenager denied Thursday that he made explosives so he could join others in Chicago and set them off at a mosque. 

Xavier Pelkey, 18, of Waterville pleaded not guilty in U.S. District Court in Bangor to one count of possession of unregistered devices. Pelkey appeared remotely before U.S. Magistrate Judge John Nivison from the Somerset County Jail.

Pelkey, who is being held without bail, was indicted Friday by a federal grand jury.

He was arrested Feb. 11 by FBI agents who allegedly found three homemade explosives and a number of hand-painted ISIS flags in Pelkey’s home. The explosives contained various items, including staples and thumb tacks, that were meant to maximize injuries if they were detonated, according to the complaint.

Pelkey colluded with two juveniles — one from Kentucky and one from the Chicago area — over social media to plan the attack, according to court documents. The trio allegedly planned to carry out the attack during spring break in late March.

One of those two defendants allegedly said that the group had planned to infiltrate the mosque, separate the children from the adults and then “murder the adults” in the name of ISIS, according to court documents.

If convicted, Pelkey faces up to 10 years in prison and a fine of up to $250,000.