The Diversity Immigrant Visa, known colloquially as the green card lottery, is offered to 50,000 people a year from countries with a historically low rate of immigration to the United States.
Introduced in its first form in 1990, it is aimed at diversifying the origins of people granted permanent residence to the US.
How do you win the green card lottery?
Applicants must have at least a high school education or its equivalent, and no criminal record, according to the State Department’s .
Countries which had more than 50,000 people emigrating to the United States during the previous five years are ineligible for the diversity visa - in 2017 this included Canada, mainland China, India, South Korea and 15 others.
Recipients of the diversity visa are chosen by a randomised computer method.
Some - the most recent statistics available. Of these, some 14,000 applications were Australians, who also qualify for the program.
Of the successful applicants, 2,524 were from Uzbekistan, the country of origin of the alleged perpetrator of this week's fatal .
Security risks from the diversity visa
Tuesday's incident was the second time the lottery has been tied to a jihadist attack inside the US.
In July 2002, Hesham Mohamed Hadayet, an Egyptian man whose wife entered the country on the green card program, shot two people dead at the ticket counter for El Al, the Israeli airline, at LA International Airport.
Despite Donald Trump's push for a crackdown on immigration - his proposed travel ban on certain countries would not have prevented any of the deadly jihadist attacks inside the United States over the past 16 years.
Most have been perpetrated by US-born and radicalised perpetrators. And most have family ties to countries not covered by the president's travel bans - Pakistan, Saudi Arabia, Afghanistan and others.
In light of the New York attack, Mr Trump has blamed the Democratic Senator Chuck Schumer who introduced the diversity visa program, although it was signed into law by then Republican President George H.W. Bush.
How can Trump abolish the green card lottery?
There have been several previous bills introduced to Congress aimed at abolishing the diversity visa program - and one to double its intake - but they have not passed.
The was introduced by Republican senators Tom Cotton and David Perdue in August 2017. It proposed the halving of the general green card intake, capping refugee intake at 50,000, and the abolition of the diversity visa program.
It is opposed by Democrats and some Republicans.
But Mr Trump’s declaration this week that he wants to end the diversity visa program will see it become a key bargaining chip as Republicans and Democrats negotiate on the DREAM Act, which would give illegal immigrants who arrived in the US as minors a path to permanent residency.
A co-sponsor of the DREAM Act - an acronym for is Republican Senator Lindsey Graham, who told Fox News on Wednesday the diversity visa program would be on the table in negotiations.
“It makes no sense to hand out visas and green cards this way. We want merit-based immigration. When it comes time to deal with … DREAM Act kids, that part of the deal should be to do away with the lottery system.”