MISSOULA, Mont. (AP) — A New York man pleaded not guilty Monday to federal charges in Montana that he lied to authorities about discussions he had about joining ISIS and attacking random people to avenge shootings at two New Zealand mosques.

Fabjan Alameti also pleaded not guilty to a firearm charge during his arraignment Monday in U.S. District Court in Missoula. The charges carry a combined maximum penalty of 18 years in prison $500,000 in fines if he is convicted.

Alameti, 21, is being held in Missoula County jail. U.S. Magistrate Judge Jeremiah Lynch scheduled a hearing next week on whether he should continue to be detained.

Authorities said Alameti used electronic communications to tell others, including an informant working for the FBI, that he wanted to fight for ISIS overseas, that he was willing to carry out an attack in the U.S. and that he wanted revenge for Muslims killed in New Zealand.

Alameti was traveling to Montana by bus on March 15 when a gunman killed 50 people in Christchurch. Alameti told the informant that he would, “attack random people to avenge the blood,” FBI Special Agent Matthew Duermeier said in a sworn statement to the court.

Alameti said he was traveling from New York to Montana where it was easier to buy a gun, an indictment filed earlier this month said.

Alameti told an FBI agent that he never made those comments, prompting the charge of making false statements to a federal officer in a matter involving terrorism, according to the indictment.

Alameti spoke with an informant about plotting an attack in the U.S. against a military facility, government building, gay club or Jewish temple, according to Duermeier.

But Alameti later said he would not carry out an attack on U.S. soil because the country had granted him citizenship, and that he moved from his home in the Bronx to Bozeman because he was having family issues and he had a job interview in Montana, according to the FBI agent’s statement.

Alameti was born in Albania.

He was arrested last month after showing up at a Bozeman firing range and paying $35 to rent an M1A rifle. Authorities said he was under the influence of marijuana at the range, which led to a charge of possession of a firearm by an unlawful user of a controlled substance.

More From 103.7 The Hawk