Spain is going the opposite way to America by legalising half a million undocumented migrants who can prove that they lived at least 5 months in the country and have no legal record.
Prime Minister Pedro Sánchez has described immigrants as representing "wealth, development and prosperity" for Spain, pointing to their contribution to the social security system.
The government and parties on the left have also emphasised the need to treat migrants in a humane way.
"Providing rights is the answer to racism," said Irene Montero, of the far-left Podemos party and a former minister in a coalition government with the Socialists.
She has campaigned for this measure, which followed an agreement between the party and the government. A civic legislative proposal, calling for a mass migrant regularisation, received the support of around 700,000 people but had been languishing in parliament.
This measure will be approved by royal decree, meaning it does not require parliamentary approval.
It is the first large-scale migrant regularisation in Spain for two decades.
Several such initiatives, by governments of both the Socialists and the conservative People's Party (PP), legalised the status of an estimated half a million migrants between 1986 and 2005.
However, Alberto Núñez Feijóo, leader of the PP, said the latest mass legalisation would "increase the pull effect and overwhelm our public services".
Pepa Millán, spokeswoman for the far-right Vox, said the initiative "attacks our identity", adding that the party would appeal before the Supreme Court in a bid to block it.
The process will be available to foreign nationals without a criminal record who can prove they lived in Spain for five months prior to 31 December 2025.
www.bbc.com