President Donald Trump has urged tougher immigration measures based on “merit” after the deadly vehicle attack in New York City, saying it was time to “stop this craziness”.

Mr Trump said on Twitter that the driver in Tuesday’s attack “came into our country through what is called the ‘Diversity Visa Lottery Program’, a Chuck Schumer beauty”, a reference to the Senate’s Democratic leader.

Officials said the attacker is an immigrant from Uzbekistan who came to the United States legally in 2010.

They have not said whether he was admitted through the diversity immigrant visa program, which covers immigrants from countries with low rates of immigration to the US.

Mr Trump also tweeted on Wednesday: “We are fighting hard for Merit Based immigration, no more Democrat Lottery Systems.

“We must get much tougher (and smarter).”

Mr Trump has backed legislation that would curb legal immigration and shift the nation toward a system that would place an emphasis on merit and skills over family ties.

The tweets followed Mr Trump’s Tuesday night statement that he ordered the Department of Homeland Security “to step up our already extreme vetting program”.

Mr Trump’s policy entails more stringent investigative measures intended to identify would-be immigrants who may sympathise with extremists or pose a national security risk to the United States.

The White House did not immediately respond to questions about the president’s tweets.

Mr Trump cited Fox And Friends on Twitter as he attacked Mr Schumer and the programme.

Mr Trump added: “We will stop this craziness.”

The diversity visa programme provides up to 50,000 visas annually by lottery.

Applicants must have a high school diploma or meet work experience requirements.

It was created as part of a bipartisan immigration bill introduced by the late senator Ted Kennedy and signed into law by President George HW Bush in 1990.

Mr Schumer, a New York Democrat who was a member of the House of Representatives at the time, proposed a programme for “diversity immigrants” in a bill he offered earlier that year.

Mr Schumer said in a statement on Wednesday that he has “always believed and continue to believe that immigration is good for America”, adding Mr Trump is “politicising and dividing America, which he always seems to do at times of national tragedy”.

He said Mr Trump had proposed cutting anti-terrorism funding in his most recent budget.

“I’m calling on the president to immediately rescind his proposed cuts to this vital anti-terrorism funding,” Mr Schumer said.

He also tweeted: “I guess it’s not too soon to politicise a tragedy.”