President Donald Trump said the Uzbek immigrant accused of killing eight people when he drove a truck down a Manhattan bike path should get the death penalty.

"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!" Trump tweeted late on Wednesday.

The suspect, Sayfullo Saipov, told investigators he was inspired by ISIS and started planning Tuesday's attack a year ago, according to a criminal complaint filed against him on Wednesday. He said "he felt good about what he had done" and asked for permission to display the flag of the militant group in his hospital room, the complaint said.

Saipov faces two charges, one of which carries the death penalty if the government chooses to seek it, Manhattan acting U.S. Attorney Joon Kim said. The charges are one count of violence and destruction of motor vehicles causing the deaths of eight people and one count of providing material support and resources to a foreign terrorist organization.

The maximum penalty for the first is death; the maximum for the second life in prison, Kim said.

Earlier Wednesday, Trump said he might send Saipov to Guantanamo Bay, which former President Barack Obama tried and failed to close. No detainee has been sent to the Guantanamo prison since 2008. 

The president later said in a tweet that he "Would love to send the NYC terrorist to Guantanamo but statistically that process takes much longer than going through the Federal system.

"There is also something appropriate about keeping him in the home of the horrible crime he committed. Should move fast. DEATH PENALTY!" he added.

Trump also seized on the deadly truck attack to step up demands for stricter immigration laws, asking Congress to end a visa program that let the suspect into the country.

The president appeared to assign some blame for the terror attack to top Senate Democrat Chuck Schumer, singling him out as a supporter of the program.

“The terrorist came into our country through what is called the ‘Diversity Visa Lottery Program,’ a Chuck Schumer beauty. I want merit based,” he wrote. 

Saipov entered the United States in 2010 through the so-called diversity visa program, designed to provide a path to U.S. residency for citizens from countries with historically low rates of immigration to the United States, the Department of Homeland Security said.

Schumer helped create the program in 1990 when he was in the House of Representatives, but he was also part of a bipartisan group of lawmakers who crafted an immigration bill in 2013 that would have done away with the program. That bill was passed by the Senate but killed by the Republican-led House.

The program, via a lottery, selects up to 50,000 people per year who receive U.S. visas, and eventually permanent residence in the United States. Those selected undergo U.S. security checks before being allowed to immigrate.

Trump celled for a "merit-based" visa system — which would favor the highly skilled — and for ending "chain migration," which allows legal immigrants to apply for relatives abroad to come to the United States. 

With Nicole Brown