He said: “We have to do what’s right to protect our citizens. We will get rid of this lottery programme as soon as possible.”

The 1990 programme awards US permanent resident visas to around 50,000 applicants from around the world each year, opening the door as well for members of their broader families to follow them, so-called chain migration.

According to Mr Trump, Sayfullo Saipov, who drove a rented truck into cyclists and pedestrians on a New York City bike path yesterday, came to the country via the programme.

Saipov was arrested after being shot by police and officials said he planned to undertake his attack in the name of the so-called Islamic State group for weeks, following online instructions from the jihadist group.

Mr Trump’s threat would further close the doors to hopeful US immigrants, after slashing the country’s annual refugee intake by more than 50%, tightening visa issuance around the world and attempting to ban travelers from 11 countries, most of them with Muslim-majority populations.

Uzbekistan is not among the 11.

The programme Mr Trump threatened aims to diversify the origins of people granted permanent residence – so-called green cards – in the United States.

In 2015 the green card lottery, applications were received for more than 14 million people, and 49,377 won green cards. That included 2,524 Uzbeks.

Mr Trump said he wants to move US immigration to a “merit-based system” and not allow immigrants to bring their extended families.

“We want to get rid of chain migration,” he said.

Taoiseach Leo Varadkar, who is on a trip to the US, reacted to news of the green card lottery saying: “When it comes to immigration policy, it is up to the American government and the American Congress to decide what its immigration policy is.

“We would have a somewhat different perspective to the United States in that we are part of a European Union, which means we are part of a labour market of 500 million people who can travel anywhere in the EU and work.

“Increasingly in Ireland, we are keen to bring in talent from other countries, from places outside the European Union. We believe that immigration, so long as it is managed well, is good for our economy.

“It makes us all better off and makes our society more diverse too. So while the approach in Britain, America and other countries is to crack down on immigration, we have a counter view; it is a good thing, good for society.”