Spain's government has finalised an amnesty measure that it estimates could enable half a million undocumented migrants to apply for legal status.
The plan, which was first announced earlier this year, will see successful applicants granted a one-year work and residency permit in the nation of 50 million people.
Applicants will be able to apply online from Thursday and in person from 20 April, with the window closing on 30 June, and they will need to prove they have been living in Spain for at least five months.
Also, they must have arrived in the country before 1 January, and don't have a criminal record.
Spain's socialist prime minister Pedro Sanchez said the measure was "an act of justice and a necessity" and that people already living and working in the country should "do so under equal conditions" and pay taxes.
However, the country's opposition, the centre-right Popular Party, has criticised the move, with party leader Alberto Nunez Feijoo calling it unsustainable.
The measure puts Mr Sanchez, who has already been an outlier on issues such as the Iran war, at odds with other European leaders, who have been trying to reduce arrivals and increase deportations to tackle illegal migration.
In a letter published on Tuesday, the prime minister said that Spain needed immigrants due to its ageing population and said that public services would "suffer" without new workers.
He also said that it was "thanks to the dynamism of migrants that the Spanish economy is currently the fastest growing in Europe".
Spain's economy is estimated to have grown by 2.8% last year and is forecast to grow by more than 2% this year, according to the IMF.
The Funcas think-tank estimates that there are around 840,000 undocumented migrants in Spain.
The country's population has sharply risen in recent years to include around 10 million people who were born outside the country, or one in every five residents.
Many are from Colombia, Venezuela and Morocco, having fled poverty, violence or political instability.
Major questions remain about how the immigration system will handle the expected caseload within the short timeframe.
Read more from Sky News:
UK military chiefs asked to find £3.5bn in savings
How Trump is blockading Iran's ports and ships
Immigration offices across Spain have raised the possibility of strike action in protest at the measure, saying the country's systems are unprepared to handle it.
The Sanchez government's measure was fast-tracked via a decree that amends immigration laws, enabling it to bypass parliament, where it lacks a majority, and a previous 2024 amnesty attempt stalled.
It's not the first time that Spain has granted amnesty to immigrants in the country illegally.
It has done so six times before between 1986 and 2005, including under conservative governments.
The issue is likely to become a key issue ahead of next year, when local and general elections are expected in the country.
(c) Sky News 2026: Spain finalises move that could see 500,000 undocumented migrants apply for legal status

UK military chiefs asked to find £3.5bn in savings - and get ready for war
Key fish stocks 'teetering on the brink of collapse' amid overfishing
Woman accused of murdering film director sister and stealing her Rolex felt unappreciated, court hears
University student accused of stabbing housemate to death