President Donald Trump on Wednesday vowed a battery of tough measures to curb immigration after a deadly terror attack in New York, but left the White House scrambling to figure out how to fulfil his promises.

Looking to burnish his hardline image after what appeared to be the first major jihadist attack on the homeland during his administration, Trump pledged sweeping changes and later called for the attacker to be put to death.

Surrounded by the cabinet, Trump — who ran for the White House on a promise to end what he called “radical Islamic terrorism” — announced he was “starting the process of terminating” America’s green card lottery.

“Diversity lottery. Diversity lottery. Sounds nice. It’s not nice,” he said. “We’re so politically correct that we’re afraid to do anything.”

The program was created 27 years ago and awards US permanent resident visas to around 50,000 applicants from around the world each year.

According to Trump, 29-year-old Sayfullo Saipov, identified by authorities as the man who plowed a rented truck into cyclists and pedestrians on a New York City bike path Tuesday, came to the country via the program in 2010.

Trump urges execution

Trump also floated deep changes to how terror suspects are prosecuted and said he would consider sending Saipov to Guantanamo Bay, the US military detention center which holds suspected foreign jihadists in Cuba.

“(We) have to come up with punishment that’s far quicker and far greater than the punishment these animals are getting right now,” Trump said.

Trump continued his hardline rhetoric on Twitter Wednesday night, calling for the attacker’s execution.

“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!”, he said, using an acronym for the Daesh group.

The White House was forced to walk back some of his comments, stressing that he was not taking executive action but looking to Congress to change decades-old laws.

“We’re going to continue pushing for and advocating for getting rid of this program,” press secretary Sarah Huckabee Sanders said of the green card lottery.

Sanders also ruled out executive action to introduce “quicker” and “greater” punishment for those guilty of terror offenses. “I believe he was voicing his frustration with the lengthy process that often comes with a case like this,” Sanders said.

And just hours after Trump and the White House suggested declaring Saipov an “enemy combatant” — opening the possibility of detention without charge and possible dispatch to Guantanamo — that idea was also undercut.