NEW YORK — Federal prosecutors brought terrorism charges Wednesday against the Uzbek immigrant accused in the truck rampage that left eight people dead, saying he was spurred to attack by the Islamic State group’s online calls to action and picked Halloween because he figured streets would be extra crowded.
Even as he lay wounded in the hospital from police gunfire, Sayfullo 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.
Saipov, 29, was brought to court in a wheelchair to face charges that could bring the death penalty. Handcuffed and with his legs shackled, Saipov nodded his head repeatedly as he was read his rights in a brief court proceeding that he followed through a Russian interpreter. He was ordered held without bail.
Outside court, his appointed lawyer, David Patton, said he hoped ‘‘everyone lets the judicial process play out.’’
‘‘I promise you that how we treat Mr. Saipov in this judicial process will say a lot more about us than it will say about him,’’ Patton said.
Late Wednesday, President Donald Trump took to Twitter to say that Saipov should get the death penalty.
Meanwhile, the FBI was questioning a second person from Uzbekistan, 32-year-old Mukhammadzoir Kadirov. A law enforcement official said Kadirov was a friend of Saipov’s and may not have any role in the case. The official wasn’t authorized to speak publicly and spoke to The Associated Press on condition of anonymity.
Prosecutors said Saipov had 90 videos and 3,800 photos on one of his two cellphones, 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, 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, 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 even rented a truck on Oct. 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, Tyree said.
He even considered displaying ISIS flags on the truck during the attack but decided it would draw too much attention, authorities said.
John Miller, deputy New York police commissioner for intelligence, said Saipov ‘‘appears to have followed, almost exactly to a T, the instructions that ISIS has put out.’’
In the past few years, the Islamic State has exhorted followers online to use vehicles, knives or other close-at-hand means of killing people in their home countries. England, France and Germany have all seen deadly vehicle attacks since mid-2016.
A November 2016 issue of the group’s online magazine detailed features that an attack truck or van should have, suggested renting such a vehicle, and recommended targeting crowded streets and outdoor gatherings, according to the SITE Intelligence Group, a militant-monitoring agency.
Carlos Batista, a neighbor of Saipov’s in Paterson, New Jersey, said he had seen the suspect and two friends using the same model of rented truck several times in the past three weeks.
It was not clear whether Saipov had been on authorities’ radar. Miller said Saipov had never been the subject of a criminal investigation but appears to have links to people who have been investigated.
In Tuesday’s attack, Saipov drove his speeding truck for nearly a mile along a bike path near the World Trade Center, running down cyclists and pedestrians, then crashed into a school bus, authorities said. He was shot in the abdomen after he jumped out of the vehicle brandishing two air guns, one in each hand, and yelling ‘‘God is great!’’ in Arabic, they said.
The attack killed five people from Argentina, one from Belgium and two Americans, authorities said. Twelve people were injured; nine remained hospitalized in serious or critical condition.
Trump called Argentine President Mauricio Macri on Wednesday to offer his condolences. Trump tweeted that he spoke to Macri ‘‘about the five proud and wonderful men’’ who were killed.
A press statement from the Argentine presidential office said that during the call, Macri reaffirmed his belief that governments must work together strongly against the ‘‘scourge of fundamentalist terrorism.’’
Earlier Wednesday, Trump called for eliminating the 1990s visa lottery program that Saipov used to come to the U.S. in 2010, and the Republican president said he would consider sending Saipov to the Guantanamo Bay detention center — an idea the White House reinforced by saying it considered Saipov to be an ‘‘enemy combatant.’’
Hours later, Saipov was charged in federal court with providing material support to a terrorist group and committing violence and destruction of motor vehicles, resulting in death. Trump’s administration could, at least in theory, still send the suspect to the U.S. base in Cuba later, though such a step would be unprecedented.
‘‘There’s no legal impediment to that,’’ said Bryan Broyles, the former deputy chief defense counsel for the Guantanamo military commissions.
On the morning after the bloodshed, city leaders vowed New York would not be intimidated and said Sunday’s New York City Marathon, with 50,000 participants and some 2 million spectators anticipated, will go on as scheduled, with increased security.
Runners and cyclists who use the popular bike path were diverted from the crime scene by officers at barricades.
‘‘It’s the messed-up world we live in these days,’’ said Dave Hartie, 57, who works in finance and rides his bike along the path every morning. ‘‘Part of me is surprised it doesn’t happen more often.’’
The slight, bearded Saipov is a legal, permanent U.S. resident. He lived in Ohio and Florida before moving to New Jersey around June, authorities said.
Birth records show he and his wife had two daughters in Ohio, and a neighbor in New Jersey said they recently had a baby boy.
Saipov was a commercial truck driver in Ohio. He also has worked as an Uber and Lyft driver.
In Ohio, Saipov was an argumentative young man whose career was falling apart and who was ‘‘not happy with his life,’’ said Mirrakhmat Muminov, a fellow truck driver from heavily Muslim Uzbekistan.
‘‘He had the habit of disagreeing with everybody,’’ Muminov said.
He said he and Saipov would sometimes argue about politics and world affairs, including Israel and Palestine. He said Saipov never spoke about ISIS, but he could tell his friend held radical views.
Associated Press writers Dake Kang in Stow, Ohio; Tom Hays, Larry Neumeister, Karen Matthews and Kiley Armstrong in New York; Deepti Hajela and Wayne Parry in Paterson, New Jersey; Shawn Marsh in Trenton, New Jersey; Ben Fox in Miami; Michael Balsamo in Los Angeles; and Michael R. Sisak in Philadelphia contributed to this report.