The green card lottery that President Donald Trump wants to end has for 22 years been a golden ticket for the proverbial huddled masses chasing the American Dream.
Every October, around 14 million would-be immigrants around the world apply for permanent legal US residency through the Diversity Visa Lottery.
The programme - known around the world as the green card lottery - has since 1995 granted visas to around one million people with no ties to the US.
The president attacked the programme following Tuesday's deadly truck attack in Lower Manhattan, allegedly by an Uzbek immigrant who won a green card in 2010.
Mr Trump earlier this year backed a Republican congressional plan to scrap the green card lottery and replace it with a merit-based system.
What is the lottery?
The lottery programme awards 50,000 visas a year - and a path to US citizenship - to applicants typically underrepresented in American immigration.
The selection is random by computer and does not require the visa recipient to have sponsorship, employment or family in the US.
Citizens of countries that have had 50,000 green cards awarded in the last five years - including the UK, Canada, Mexico, India and China - cannot apply.
The only other requirement is a high school education or a regional equivalent in the applicant's country of origin.
Winners are also permitted to bring their spouses and young children, the so-called chain migration that President Trump also wants to end.
The State Department's diversity green card lottery makes up a small proportion of the roughly one million green cards issued by the US per year.
Candidates must have a face-to-face interview with US immigration officials.
Applicants found to have any terrorism connections are ruled inadmissible.
Why was it created?
The visa lottery was introduced through the Immigration Act of 1990, and went into effect in 1995.
The drive for the programme stemmed from the late 1980s, when tens of thousands of undocumented Irish immigrants moved to the US.
According to CUNY Brooklyn College political scientist Anna Law, prominent Italian-American and Irish-American members of Congress lobbied for the measure.
The US lawmakers argued that "the 'old-seed' immigrant groups were being shut out by newer groups from Asia and Latin America", says Professor Law.
It followed a 1965 immigration law that had aimed to do away with an existing quota system which heavily benefited white Europeans.
The 1965 legislation focused on skilled workers and family sponsorship visas.
But critics said it disproportionately favoured immigrants from such countries as Mexico, India, China and the Philippines.
Can Trump abolish the green card lottery?
The president himself does not have the authority to end the programme, and must rely on Congress to create new immigration laws.
Mr Trump has backed a conservative bill in the US Senate which aims to scrap the green card lottery, halve the number of immigrants to the US and cap the number of refugees.
The Reforming American Immigration for Strong Employment (Raise) Act was introduced in February 2017, but has failed to attract the votes needed to pass the Senate, despite Mr Trump's support.
Members of Congress have previously said that overhauling the nation's immigration system is not a high priority, as they instead focus on fixing the healthcare system and overhauling the tax code.
We are fighting hard for Merit Based immigration, no more Democrat Lottery Systems. We must get MUCH tougher (and smarter). @foxandfriends— Donald J. Trump (@realDonaldTrump) November 1, 2017
Who comes in through the lottery?
The legislation was originally introduced to boost European immigration, but it has also resulted in higher rates of immigration, particularly from Africa.
Sub-Saharan immigrants are more likely than any other US migrant to have entered through the lottery programme, according to a study by Pew Research Center.
Citizens from countries that Mr Trump has proposed banning from travelling to the US have also entered through the lottery system.
In 2015, around 10,500 citizens from six of the Muslim-majority countries that the White House wants blacklisted were selected for the diversity visa lottery, according to the US State Department.