An Uzbek immigrant accused of a deadly truck attack on a New York cycle path has been charged with providing material support to a terrorist group and violence and destruction of motor vehicles.
Suspect Sayfullo Saipov was charged on Wednesday in a criminal complaint following the Tuesday afternoon attack that killed eight people near the World Trade Centre.
Even as he lay wounded in the hospital from police gunfire, 29-year-old Saipov asked to display the Islamic State group's flag in his room and said "he felt good about what he had done," prosecutors said in court papers.
He appeared in the New York federal courthouse in a wheelchair, handcuffed and with his feet shackled, and was ordered to be detained.
His lawyers said they were not seeking bail, and Saipov did not enter a plea. A judge set his next court date for November 15.
Outside court, his appointed lawyer, David Patton, said he hoped "everyone lets the judicial process play out".
"I promise you that how we treat Saipov in this judicial process will say a lot more about us than it will say about him," Mr Patton said.
Meanwhile, president Donald Trump tweeted that Saipov should get the death penalty.
He said: "NYC terrorist was happy as he asked to hang ISIS flag in his hospital room. He killed 8 people, badly injured 12. SHOULD GET DEATH PENALTY!"
Separately, the FBI was questioning a second person from Uzbekistan, 32-year-old Mukhammadzoir Kadirov.
A law enforcement official said Mr Kadirov was a friend of Saipov's and may not have any role in the case.
Prosecutors said Saipov had 90 videos and 3,800 photos on one of his two mobile phones, many of them ISIS-related pieces of propaganda, including images of prisoners being beheaded, shot or run over by a tank.
Saipov left behind knives and a note, in Arabic and English, that included Islamic religious references and said, "Islamic Supplication. It will endure," FBI agent Amber Tyree said in court papers. "It will endure" commonly refers to ISIS, Ms Tyree said.
Questioned in his hospital bed, Saipov said he had been inspired by ISIS videos and began plotting an attack about a year ago, deciding to use a truck about two months ago, Ms Tyree said.
During the last few weeks, Saipov searched the internet for information on Halloween in New York City and for truck rentals, the agent said.
Saipov rented a truck on October 22 to practice making turns, and he initially hoped to get from the bike path across lower Manhattan to hit more pedestrians on the Brooklyn Bridge, Ms Tyree said.
He even considered displaying ISIS flags on the truck during the attack but decided it would draw too much attention, authorities said.