Federal authorities Wednesday charged the 29-year-old Uzbek immigrant they say plowed a rented truck into people walking and cycling on a New York City bike path, killing eight, with providing support to a terrorist organization, alleging that he was inspired by the Islamic State to inflict mayhem and chose Halloween because he figured there would be more people on the street.

In court papers, federal authorities said Sayfullo Saipov told the FBI he began planning his attack a year ago, though he settled on using a truck as a weapon only two months before.

Saipov said he was proud of what he had done — even requesting to display the Islamic State flag in his hospital room — and that he was inspired particularly after he watched a video of Islamic State leader Abu Bakr al-Baghdadi, court papers say. In that video, Baghdadi questioned what Muslims in the United States were doing to respond to the killing of other members of their faith in Iraq, Saipov told the FBI.

[Suspect in NYC fatal terror attack ‘should get death penalty,’ Trump tweets]

In addition to the terrorism charge, Saipov faces one count of violence and destruction of a motor vehicle — a charge that, because prosecutors allege someone died as a result, could carry with it the death sentence.

More than a dozen people were also wounded Tuesday.

Police and FBI officials decried the incident as the worst terrorist attack in New York since Sept. 11, 2001, and they immediately launched an international investigation to uncover how and why it happened. They urged New Yorkers to carry on as normal, even as they said they would beef up security at this weekend’s New York City Marathon and explore other steps to prevent a similar incident.

“What happened yesterday was not okay,” New York City Police Commissioner James O’Neill said. “It will never be something that any of us just accept as inevitable.”

Saipov, who drove for Uber and once had his own trucking company, apparently was radicalized after he came to the United States, and a note written in Arabic that he left at the scene extolled the Islamic State, authorities said.

[8 killed by New York motorist in ‘cowardly act of terror’]

Translated to English, the note said, in part: “Islamic Supplication. It will endure,” court papers say.

“The gist of the note was that the Islamic State would endure forever,” John Miller, the deputy commissioner of intelligence and counterterrorism at the New York City Police Department, said.

David Patton, Saipov’s attorney, said: “In a case like this involving so much tragedy, it’s more important than ever to let the judicial process play out. How we as a society treat Mr. Saipov will say more about us than it will about him.”

It was not immediately clear whether investigators had found any evidence that others had knowledge of, or assisted with, the plot. The FBI said briefly Wednesday night that agents were looking for another man, identified as 32-year-old Mukhammadzoir Kadirov, or Muhammad Kadirov, in connection with the investigation. But they gave no indication why they were doing so or if he was suspected of having a role, and just minutes later, they said they were no longer seeking him.

[Extreme right blames Schumer for New York terror attack]

“We believed he had information related to yesterday, but we are not looking for that individual any longer,” FBI Assistant Director in Charge William Sweeney said, adding, “We have found him, and I’ll leave it at that.”

A person who was in touch with Saipov’s and Kadirov’s families Wednesday said Kadirov is in New Jersey, has retained an attorney and is cooperating with law enforcement officials, but that he was not under arrest as of Wednesday evening.

The person, who spoke on the condition of anonymity because of the sensitivity of the subject, said Kadirov is Saipov’s cousin. The person, who spoke to Kadirov over the phone, said Kadirov seemed “utterly shocked and horrified” by what Saipov had done.

Investigators found on Saipov’s phones 90 videos and 3,800 images, many of which seemed to be Islamic State propaganda, videos of the group’s fighters killing prisoners or bomb-making instructions. He told agents that he wanted to kill as many people as he could and considered putting Islamic State flags at the front and back of his truck — but ultimately decided it would draw too much attention, court papers say.

National security officials have warned that as the Islamic State is being routed in Syria and Iraq, the group’s supporters might try to carry out crude attacks in the places where they live. The group has urged its supporters to use vehicles as weapons, and the tactic has been employed in France, Britain, Germany, Sweden, Spain and Canada.

The group, though, did not immediately claim responsibility for the incident in New York, according to the SITE Intelligence Group, which monitors extremist activity.

Officials on both sides of the political aisle agreed Saipov’s rampage was an act of terrorism, but there was almost immediate disagreement on how to respond.

President Donald Trump decried the way Saipov entered the United States — via a State Department program that grants visas to people from countries with historically low rates of immigration to the United States — and said he would ask Congress to end it. On Twitter, Trump asserted that he would increase already “extreme” vetting of those wanting to come to the country, and he took a swipe at Senate Minority Leader Charles Schumer, D-New York.

New York Gov. Andrew Cuomo, D, fired back that Trump’s tweet was “not helpful” and said he was “bothered by an attempt by anyone to politicize this situation.”

The president also said he was considering sending Saipov to the U.S. military prison at Guantanamo Bay, Cuba, and White House press secretary Sarah Huckabee Sanders said later that “I believe we would consider this person to be an enemy combatant.”

Sanders, though, did not seem to affix any legal meaning to the term, and of sending Saipov to Guantanamo Bay, she said Trump was trying to indicate that he “would support that, but he wasn’t necessarily advocating for it.”

Even the suggestion of labeling Saipov an enemy combatant or putting him in Guantanamo Bay — which probably would spark years of legal wrangling — drew immediate condemnation from civil liberties groups. The court system at the military prison is still struggling to bring to trial those accused of playing roles in the 9/11 attacks.

“Military detention would be unconstitutional, contrary to congressional statutes and unnecessary,” Hina Shamsi, director of the ACLU National Security Project, said.

On Tuesday afternoon, Saipov is alleged to have ultimately crashed into a school bus and emerged from his truck armed with a paintball gun and pellet gun. A passer-by flagged down police officers responding to an unrelated call at a school in the area, and one of them shot and wounded Saipov, police said.

Court papers say Saipov shouted “Allahu akbar,” meaning “God is great” in Arabic, after he got out of the truck. Investigators found a stun gun on the floor of his truck and three knives in a black bag he was carrying, court papers say.

Among those Saipov is accused of killing were a group of childhood friends from Argentina, now in their late 40s, who had been planning a trip to New York for years; a young mother; and two men in their 20s and 30s from New York and New Jersey.

Police said Saipov had never been the “subject” of an FBI or New York police investigation, though they stopped short of saying he was unknown to law enforcement. Miller said “he will have some connectivity to individuals who were the subjects of investigation, though he himself was not.” Law enforcement officials said the FBI has been investigating a friend of Saipov’s, but that probe had not previously found derogatory information against Saipov.

The FBI has, in the past, scrutinized people who have gone on to commit attacks. Perhaps most notably, agents investigated Omar Mateen, who shot and killed 49 people last year in an Islamic State-inspired attack in an Orlando nightclub, for 10 months in 2013, even putting him under surveillance and recording his calls before ultimately closing the case.

A perpetrator of the Boston Marathon bombing in 2013 also drew scrutiny before that attack.

Saipov arrived in the United States in March 2010 and lived in Ohio, Florida and New Jersey, according to authorities. He started a trucking company, was married, had children and at one point, worked for Uber, where he passed a background check. His wife has told the FBI that she did not know he was planning violence, a person familiar with the case said.

Those who knew Saipov said they were surprised by what had happened – though some acknowledged that he had antagonistic tendencies.

Mirrakhmat Muminov, 38, a truck driver in a suburb of Akron, Ohio, said that Saipov lived in his community and worked part-time for his trucking company for a few months. But he had to fire him because he was often late for deliveries and was aggressive with customers.

“He was always aggressive and nervous,” Muminov said in an interview. “We warned him in our community: ‘Don’t be nervous. You have to stay calm.’”

Follow the Bangor Daily News on Facebook for the latest Maine news.