Donald Trump's tweet calling for the New York terror attack suspect to be executed could prejudice the trial, legal experts have warned.

The US President called for the death penalty for Sayfullo Saipov, the 29-year-old Uzbek immigrant accused of ploughing a truck down a New York City bike path, killing eight people, describing him as "a terrorist."

Saipov, who was hospitalised after he was shot by a police officer and arrested, told investigators he had been inspired by watching Isis videos and began plotting Tuesday's attack a year ago, according to a criminal complaint filed against him.

He confessed to authorities he made a trial run with a rental truck on 22 October to practice turning the vehicle and "stated that he felt good about what he had done" after the attack, the complaint said.

"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!" Mr Trump tweeted.

Presidents are typically advised to avoid commenting on active legal proceedings, as such comments can be used by defence lawyers to argue their clients cannot get a fair trial, The New York Times reports.

"Mr President, we all know he should get the death penalty. But when *you* say it, it makes it harder for DOJ to make that happen," Andrew C McCarthy, a former assistant US attorney said.

Trump calls New York attack suspect an 'animal' and signals scrapping lottery visa scheme

Saipov was charged with one count of providing material support and resources to a foreign terrorist organization, specifically Isis, and one count of violence and destruction of motor vehicles causing the deaths of eight people.

Manhattan acting US Attorney Joon Kim said the first count carries a maximum penalty of life in prison, while the second would make Saipov eligible for capital punishment if convicted, if the government chose to seek the death penalty. Additional or different charges could be brought later in an indictment, Mr Kim said.

The complaint said Saipov was particularly motivated by seeing a video in which Abu Bakr al-Baghdadi, the leader of Isis, exhorted Muslims in the United States and elsewhere to support the group's cause.

Investigators found thousands of Isis-related propaganda images and videos on a phone belonging to Saipov, including video clips showing Isis prisoners being beheaded, run over by a tank and shot in the face, the complaint said.

New York Truck attack Show all 6 1 /6 New York Truck attack New York Truck attack Investigators inspect the truck following the attack Investigators inspect a truck following a shooting incident in New York on 31 October 2017. Several people were killed and numerous others injured in New York on Tuesday when a suspect plowed a vehicle into a bike and pedestrian path in Lower Manhattan, and struck another vehicle on Halloween, police said. A suspect exited the vehicle holding up fake guns, before being shot by police and taken into custody, officers said. The motive was not immediately apparent. Getty New York Truck attack A paramedic looks at a body along the bike path A paramedic looks at a body covered under a white sheet along the bike path 31 October 2017, in New York. A motorist drove onto a busy bicycle path near the World Trade Center memorial and struck several people Tuesday, police and witnesses said. AP Photo/Bebeto Matthews New York Truck attack The truck driver collided with a school bus Authorities respond near a damaged school bus Tuesday, 31 October 2017, in New York. A motorist drove onto a busy bicycle path near the World Trade Center memorial and struck several people, police and witnesses said. Two adults and two children were on the bus at the time. AP Photo/Bebeto Matthews New York Truck attack A young girl reacts to the scene A young girl reacts as police officers secure an area following a shooting incident in New York on 31 October 2017. Several people were killed and numerous others injured in New York on Tuesday after a vehicle plowed into a pedestrian and bike path in Lower Manhattan, police said. 'The vehicle struck multiple people on the path,' police tweeted. 'The vehicle continued south striking another vehicle. The suspect exited the vehicle displaying imitation firearms & was shot by NYPD.' DON EMMERT/AFP/Getty Images New York Truck attack Police officers arrive at the scene Police officers arrive at the scene following a shooting incident in New York on 31 October 2017. Multiple people were hurt in downtown Manhattan, US media reported after police confirmed that they were responding to reports of a shooting. Police said they had mobilized to the scene in Lower Manhattan and that one person was in custody, giving no further details. DON EMMERT/AFP/Getty Images New York Truck attack Emergency personnel respond to truck attack in lower Manhattan Emergency personal respond after reports of multiple people hit by a truck after it plowed through a bike path in lower Manhattan on 31 October 2017 in New York City. According to reports up to six people may have been killed. Kena Betancur/Getty Images

Earlier in the day, Mr Trump said he would be open to transferring Saipov to the military prison at Guantanamo Bay, Cuba, where other suspects including alleged 11 September plotters are held.

Mr Kim, the federal prosecutor, said there was nothing about charging Saipov in civilian court that would necessarily prevent him from later being declared an enemy combatant.