President Donald Trump called Thursday for the man charged over the New York truck attack to be executed, after investigators said he confessed to being inspired by Islamic State group propaganda.

Trump had earlier said he was considering sending Sayfullo Saipov, 29, to the military's notorious Guantanamo Bay detention center, but backed off the idea in a blast of early morning tweets calling for the 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 tweeted.

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

Saipov appeared in a New York federal courtroom Wednesday on terrorism charges after he allegedly drove a rented pickup truck down a mile-long stretch of bike path Tuesday in Lower Manhattan's West Side, where children and their parents were preparing to celebrate Halloween.

Eight people were killed, five of them friends from Argentina celebrating the 30th anniversary of their high school graduation.

A 31-year-old Belgian mother was also among the dead and 12 other people were wounded in the worst attack in New York since the September 11, 2001 Al-Qaeda hijackings.

Police shot Saipov in the abdomen after he allegedly ran over his victims and exited his truck brandishing fake guns.

Federal prosecutors have announced two charges so far: provision of material support and resources to a designated foreign terrorist organization, and violence and destruction of motor vehicles.

The material support charge carries a maximum sentence of life imprisonment, but federal prosecutors can also seek the death penalty, although a capital punishment case would be extremely rare in New York.

'Felt good'
The complaint said Saipov, an Uber driver and father-of-three who moved to the United States in 2010, confessed to acting in the name of IS and "felt good about what he had done," even demanding to hang an IS flag in his hospital room.

"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 wrote on Twitter late Wednesday.

Trump's Guantanamo tweets reflect a reality at the naval base: If Saipov were sent there his trial would likely be delayed by many years.

Since the first inmates arrived in 2002, only eight have been convicted in the military commissions there, according to Human Rights Watch.

Three of those convictions were overturned and another three were partially invalidated, and the entire legal process has been beset by endless challenges and allegations of government misconduct.

Saipov deliberately intended to attack on Halloween, determined to kill as many people as possible and believing that the streets would be more crowded for the holiday, authorities said.

A year ago, he first planned an attack in the United States, before settling two months ago on a vehicle strike, prosecutors said.

"He appears to have followed almost exactly to a 'T' the instructions that ISIS has put out in its social media channels before with instructions to their followers on how to carry out such an attack," senior police officer John Miller said.

He was found in possession of knives, a stun gun in his vehicle and two cell phones contained thousands of IS propaganda images and dozens of videos that showed IS fighters killing prisoners, prosecutors said.

While investigators are still working round the clock, it appears Saipov only became radicalized after moving to America.

'Violent temper'
The New York Times reported that he arrived as a moderate Muslim, a university-educated accountant from a wealthy family and dreamt of making it in the US, but that life did not work out as he planned.

Instead he developed a violent temper, lost jobs and an imam worried he increasingly misinterpreted Islam, the Times said.

After winning the green card lottery, the newspaper reported that he lived in Ohio, and eventually found work as a trucker before marrying a fellow Uzbek immigrant in 2013. The couple had three children.

He ran up multiple traffic infractions and the family moved to New Jersey, to be closer to relatives, but still he was not happy.

A neighbor in the Jersey town of Paterson told AFP the family moved into an apartment around a year ago, and that she saw him with his children, exchanging the occasional hello but nothing more.

On Wednesday, Trump vowed to "get rid" of the green card lottery "as soon as possible," seizing on the New York to press his campaign-agenda of restricting immigration.

He has already slashed annual US refugee intake by more than 50 percent, tightened visa issuance around the world and attempted to ban travelers from 11 countries.