An Albanian national who talked about joining ISIS and attacking random people to avenge the mosque shootings in New Zealand was arrested at a gun range in Montana, authorities say.
Fabjan Alameti, 21, appeared before a United States magistrate judge on Thursday (local time) on charges of possession of a firearm by an unlawful user of a controlled substance and making false statements involving international and domestic terrorism.
US Magistrate Judge Jeremiah Lynch ordered him detained for further proceedings.
Mr Alameti's federal public defender John Rhodes said he was working on a proposal for his client's release. He declined further comment.
Authorities first interviewed Mr Alameti in 2018, and he later made pro-ISIS comments on Facebook, FBI Special Agent Matthew Duermeier said in a sworn statement filed with the court.
Starting in January, Mr Alameti spoke with a federal informant about fighting with the terrorist organisation in Iraq and Syria and plotting an attack in the US against a military facility, recruitment centre, government building, gay club or Jewish temple, Mr Duermeier said.
But Mr Alameti also later said he would not carry out an attack on US soil because the country had granted him citizenship, the FBI agent's statement said.
Mr Alameti told the informant he moved from his home in the Bronx to Bozeman last month because he hated his life in New York City; he was having family issues and he had a job interview in Montana, where it was easier to buy a gun, Mr Duermeier said.
Mr Alameti was travelling to Montana by bus on 15 March when a gunman opened fire in a Christchurch mosque and killed 50 people.
He asked the federal informant to send him a link to the video of the shooting because it would fuel him.
"I will attack random people to avenge the blood," Mr Alameti told the informant, according to Mr Duermeier.
Once in Bozeman, Mr Alameti looked at guns in pawn shops and Wal-Mart, and he bought an air rifle.
He was kicked out of a hotel for smoking marijuana and hospitalised on 25 March for apparent acute alcohol intoxication, Mr Duermeier said.
After he was released, he went to the Bozeman police department to pick up his belongings, where he was interviewed by an officer.
In that interview, Mr Alameti denied being linked to anyone who asked him to travel overseas, said he never expressed a desire to harm Americans, never expressed a desire to fight the US military overseas and never expressed a desire to fight for ISIS, Mr Duermeier said.
On Tuesday, another federal informant recorded Mr Alameti saying while buying marijuana that he could die the following day and said he wanted to "shoot up" the hotel that he had been kicked out of.
He said he wanted to go to a gun range the following day and shoot a rifle that he had seen in a pawn shop, the FBI agent's statement said.
On Wednesday, Mr Alameti showed up at the firing range, paid $35 to rent an M1A rifle and was arrested when he took possession of it, Mr Deurmeier said.
The federal charge on which he was arrested said it was illegal to possess a weapon while using drugs, and the false statement charge is related to the answers he gave Bozeman police during his interview.