It did not take long for President Donald Trump to switch from words of condolence to words of action once it was clear that the murder of eight people in lower Manhattan was an act of terror.

First, he announced that the Department of Homeland Security would step up his existing policy of “extreme vetting”, which involves more stringent checks to identify individuals who could pose a security risk to the US.

Next, Mr Trump demanded an end to the diversity visa programme, better known as a green card lottery, used by the New York suspect Sayfullo Saipov to enter the country.

It was a classic piece of Trumpaneering: tapping into his supporters' fear of immigration while offering decisive action. And like so many of his policy moves, it came from a howling, partisan online response of tweets and memes, all fanned and fuelled by Mr Trump’s hardline supporters.

Mr Trump’s case is simple. The suspect, Saipov, arrived from Uzbekistan in 2010 on a green card that he won in an annual draw that hands out 50,000 visas to people from countries with a low rate of migration to the US.

Candidates must have completed high school but they need not have the advanced skills or experience demanded by other classes of work permits.