Sweden's parliament passed a bill Thursday giving thousands of young asylum seekers a second chance to stay until they complete high school, after the overwhelmed migration agency failed to process their applications before they became adults.
The decision will allow thousands of asylum seekers who were minors when they arrived in Sweden to re-apply for temporary residency.
Asylum rules are more favourable for minors.
Because asylum applications can take more than a year on average to process in Sweden, which has taken in more migrants per capita than any other country in Europe, some applicants turn 18 by the time their application is considered.
"We need to take political responsibility. (Asylum seekers) should not be affected because the Swedish authorities haven't managed to process their application on time," Maria Ferm, a lawmaker for the Greens, told TT news agency.
Passed with 166 votes against 134 with 48 abstentions, the bill was backed by the minority Social Democrats and Greens government and the Centre party while widely opposed by the conservative Moderates and the far-right Sweden Democrats.
The move exposed a rift within the centre-right Alliance before the September 9 general election in which security and immigration are the two main themes.
"The humane consequences of stopping the proposal would be far too grave," Annie Loof, leader of the opposition Centre Party, said in a Facebook post.
The law will enter into force on July 1. To be considered for temporary residency, asylum seekers must re-apply by the end of September.
And it is only valid for those who initially applied no later than November 24, 2015, when Sweden tightened its asylum rules to deter migrants from travelling to Sweden.
In 2016, the Nordic nation announced it would only grant temporary three-year residence permits and limit the number of refugees who would be allowed to join family members already settled in the country.
The move was heavily criticised by human rights campaigners.
The Scandinavian country has registered 400,000 asylum applications since 2012 -- or one for every 25 inhabitants, a record in Europe -- with a peak of 162,000 applications in 2015.