Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

New York City terror suspect Sayfullo Saipov was so proud of the carnage he caused that he asked investigators if he could display the ISIS flag in his hospital room, authorities said.

"[He] stated that he felt good about what he had done," a criminal complaint against the 29-year-old Uzbekistan native said.

Saipov also wanted to put the terror group's flags on the rented truck he allegedly used to plow into a Manhattan bike path but decided against it because it could draw attention before he carried out the attack that killed eight and injured 11, authorities said.

The details emerged in court papers as Saipov was charged Wednesday evening with one count of material support to a terrorist organization and one count of violence and destruction of a motor vehicle. He appeared in federal court in a wheelchair but has since been transferred from the hospital to jail.

After his arrest, the 29-year-old native of Uzbekistan waived his right to remain silent and told investigators he had become radicalized by watching ISIS videos on his phone and was inspired by ISIS leader Abu Bakr al-Baghdadi's call for revenge on the United States, the federal complaint says.

He said he began planning an attack a year ago and decided to use a truck two months ago, according to the complaint. He rented a truck more than a week ago to practice making turns and chose Halloween as the attack date because he thought it would more crowded on the street, it said.

"Saipov wanted to kill as many people as he could," an FBI agent wrote in the complaint.

The attack — which was the deadliest terror operation in New York City since Sept. 11, 2001 — was straight out of the ISIS playbook, officials said.

"He seems to have followed the regimen prescribed," said John Miller, the deputy New York police commissioner for intelligence, referring to a manual called "Just Terror Tactics," which ISIS published late last year.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Eight people were killed when a truck rented from a New Jersey Home Depot rammed into a crowd of people on a bike path off a Manhattan highway on Tuesday afternoon. The driver, whom authorities identified as Saipov, then crashed into a school bus, jumped from the truck holding two imitation guns and shouted "Allahu Akbar" — Arabic for "God is Great" — before a New York police officer shot him in the stomach.

Saipov told investigators that his original plan was to continue onto the Brooklyn Bridge and kill pedestrians, the complaint said. He had a bag of knives in the truck but wasn't able to grab them before he jumped out after the crash on the highway.

Multiple law enforcement sources said it appeared that the attacker acted alone. But they said the FBI was questioning a second Uzbek national, whom they described as an associate of Saipov who had been in contact with him in recent weeks, to find out what he might know.

Related: Who Were the Victims of the New York Terrorist Attack?

The second Uzbek national wasn't believed to have been involved in the attack, the sources said, but investigators weren't ruling out the possibility that other people may have known about Saipov and even perhaps about his intentions. John Miller, the deputy New York police commissioner for intelligence, said investigators suspected that Saipov "will have some connectivity to subjects" who are or were previously under investigation.

"We'll see as we go down the road if he acted alone or if he had some help," New York Police Commissioner James O'Neill said Thursday on TODAY.

O'Neill said trying to unravel the mind of a person who engages in terrorism can be difficult: "Everybody's got to understand this is what we're dealing with."

The complaint and the accounts of numerous investigators and other law enforcement sources, some of whom spoke publicly and others of whom spoke to NBC News on condition that they not be identified, described a fervent follower of ISIS, who spent a year fashioning the attack to the group's specifications.

An image from 'Just Terror Attacks,' an instruction manual published early this year by the Islamic State terrorist group.

The ISIS manual Miller referenced instructs independent actors on how to maximize damage and casualties using unorthodox weapons like trucks, which are regulated far less stringently than firearms are. It reads, in part:

"Though being an essential part of modern life, very few actually comprehend the deadly and destructive capability of the motor vehicle and its capacity of reaping large numbers of casualties if used in a premeditated manner."

Sayfullo Habibullaevic Saipov in security camera video recorded Tuesday in the Home Depot in Passaic, New Jersey, where the truck used in a terrorist attack in Manhattan was rented. FBI

Until this week, Saipov lived quietly with his Uzbek-born wife in Paterson, New Jersey, usually making his living as a long-haul trucker and as a driver for the ride-sharing service Uber.

Related: Trump Says Consider Sending NYC Truck Attacker to Guantanamo

Former associates and neighbors in other cities where he has lived generally described him as not particularly friendly — an Uzbek community leader in Stow, Ohio, called him something of a hothead — but not as someone you would ever see morphing into a terrorist killer.

Saipov used his real name to rent the truck and reported that he needed the truck for only an hour and 15 minutes, according to the criminal complaint.

After the assault on Tuesday, authorities found a note in Arabic and English about 10 feet from the truck. It read:

"No God but God and Muhammad is his Prophet ... Islamic Supplication. It will endure."

"'It will endure' is commonly used to refer to ISIS,'" the complaint said.