NEW YORK — The suspect in the deadly New York City truck rampage was inspired by the Islamic State group’s online videos and plotted his attack for two months, renting a truck ahead of time to practice turning it, federal authorities said in bringing terrorism charges against the Uzbek immigrant.

President Donald Trump said on Twitter that Sayfullo Saipov "SHOULD GET DEATH PENALTY!"

Saipov chose Halloween for the attack because he figured there would be more people on the streets, according to the criminal complaint. And after his trail of terror was halted by a police bullet, he asked to display the Islamic State flag in his hospital room, saying "he felt good about what he had done," authorities said.

Brought to court in a wheelchair, Saipov was held without bail on charges that could bring the death penalty. Separately, the FBI was questioning people who might have information about his actions before the attack, including a second Uzbek man.

The charges against Saipov, 29, came just a day after the attack near the World Trade Center killed eight people. Investigators in multiple states raced to retrace Saipov’s steps and understand his motivations, which they said were illuminated by a note he left by the truck: "Islamic Supplication. It will endure." The phrase "it will endure" commonly refers to the Islamic State group, and Saipov had a cellphone loaded with the group’s propaganda, an FBI agent said in the criminal complaint.

Investigators work around the wreckage of a Home Depot pickup truck a day after it was used in a terror attack in New York on November 1, 2017. JEWEL SAMAD/AFP/Getty Images

Handcuffed and with his legs shackled, Saipov nodded his head as he was read his rights in a brief court proceeding that he followed through a Russian interpreter. 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.

This handout photograph obtained via the FBI shows Mukhammadzoir Kadirov, 32, in a poster obtained November 1, 2017 saying it was "seeking information… in relation to the deadly attack in the Tribeca neighborhood of New York City" on October 31, 2017. AFP PHOTO/FBI/Eva Claire Hambach

The FBI released a poster saying it was looking for one of Saipov’s associates, Mukhammadzoir Kadirov, only to announce less than 90 minutes later that it had found him. A law enforcement official said Kadirov was a friend of Saipov’s and may not have any role in the case. Saipov didn’t have many friends, the official said. The official wasn’t authorized to speak publicly and spoke to The Associated Press on condition of anonymity.

A married father of three and former commercial truck and ride-hailing driver, Saipov began planning an attack a year ago and settled on a truck assault a couple of months ago, according to the criminal complaint.

During the last few weeks, Saipov searched the internet for information on Halloween in New York City and rented a truck to practice turns. He chose a route along a lower Manhattan highway and initially hoped to continue to hit more pedestrians on the Brooklyn Bridge, the complaint said.

Police gather outside the residence of Sayfullo Saipov, 29, the suspect who drove a pickup truck on a bike path in lower Manhattan, killing 8 peple and injuring 12 on November 1, 2017 in Paterson, New Jersey. (Photo by Mark Makela/Getty Images)

Ultimately, Saipov sped down a bike path on a riverfront esplanade in a rented truck for nearly a mile Tuesday, running down cyclists and pedestrians, before crashing into a school bus, authorities said. He was shot after he jumped out of the vehicle brandishing two air guns and yelling "God is great!" in Arabic, they said. Knives were found in a bag he was carrying. A stun gun was found inside the truck.

In the past few years, the Islamic State group 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.

The crashed vehicle used in what is being described as a terrorist attack is moved away from the scene in lower Manhattan the day after the event on November 1, 2017 in New York City. (Photo by Spencer Platt/Getty Images)

The fact that a note was left at the scene was significant, because it showed he was following their instructions to the letter, NYPD Intelligence and Counterterrorism head John Miller said Thursday on "CBS This Morning."

"He was following the ISIS instructions which says if you’re going to do this you need to claim credit for ISIS or we won’t know you’re one of us and to yell it out, post it online or their magazine even suggested leaving leaflets and this seems to touch on that last piece," he said.

Saipov’s court appearance came just hours after President Donald Trump said he would consider sending Saipov to the Guantanamo Bay detention centre in Cuba — an idea the White House reinforced by saying it considered Saipov to be an "enemy combatant." Detainees at Guantanamo accused of supporting militants have faced military tribunals, rather than trials in the U.S. legal system.

By afternoon, though, Saipov was in federal court facing charges that include providing material support to a terrorist group. 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.

The president took to Twitter on Wednesday, saying Saipov should get the death penalty. He repeated the call Thursday, saying he’d love to send the "NYC terrorist" to Guantanamo, but that process would take longer than going through the federal system. Trump said there was something "appropriate" about keeping Saipov where he committed the crime, and tweeted, "Should move fast. DEATH PENALTY!"

Would love to send the NYC terrorist to Guantanamo but statistically that process takes much longer than going through the Federal system…

Trump also has called for eliminating the 1990s visa lottery program that Saipov used to come to the U.S. in 2010.

Miller said Saipov had never been the subject of a criminal investigation by the FBI or New York police, but appears to have links to people who have been investigated. He wouldn’t elaborate. Miller said Thursday he appeared to be the only suspect, but he cautioned the investigation was relatively fresh.

Bahij Chancey, 26, center, holds a photo of his friend and, one of the victims Nicholas Cleves, during an interfaith vigil for peace at Foley Square in response to the Manhattan truck attack, Wednesday, Nov. 1, 2017, in New York. (AP Photo/Andres Kudacki)

The attack killed five people from Argentina, one from Belgium and two Americans, authorities said. Twelve people were injured.

City leaders vowed New York would not be intimidated and said Sunday’s New York City Marathon would go on as scheduled, with increased security.