(CNN) -- Nearly all underage immigrants waiting for visas to stay in the United States will have to start the process all over again when they turn 21, the Supreme Court ruled on Monday.
The 5-4 vote created an unusual bloc of justices with at least five different interpretations of the federal law at issue.
The case deals with whether those seeking permanent status under a family preference provision, but then "age out" because of the often lengthy visa approval process, have a right to appeal the agency's order reassigning them to the adults-only category.
The majority agreed with the Obama administration, concluding the Board of Immigration Appeals made a "reasonable" interpretation of what the court called "ambiguous language" in the immigration application rules.
In the face of such ambiguity, courts typically defer to the agency's interpretation, as the justices did in this instance.
The Supreme Court appeal came from a Salvadoran immigrant, Rosalina Cuellar de Osorio, who applied for visas on behalf of her and her 13-year-old son. The lengthy process stretched past the young man's 21st birthday, at which time he lost his "automatic conversion and priority date retention."
That meant he went to the back of the line to begin the application process anew to become a lawful permanent resident, which caused him to wait years longer for the visa.
The appeal is not related to the recent spike of unaccompanied immigrant children coming over the U.S. border from Mexico. Federal officials last week had begun transporting about 1,000 such youngsters from Texas to Arizona, as part of a resettlement process for the minors to their native countries. Most are from Central America.
Referring to an aged-out applicant, Justice Elena Kagan said, "In the unavoidably zero¬-sum world of allocating a limited number of visas, the board could decide that he belongs behind any alien who has had a lengthier stand-alone entitlement to immigrate."
"Were we to overturn the board in that circumstance, we would assume as our own the responsible and expert agency's role," Kagan added. "We decline that path."
Under the court's ruling, only a small group of young visa applicants would be eligible under the Child Status Protection Act. That allows them to keep their priority underage status -- "Peter Pan-like" as Kagan put it -- throughout the immigration process, even after they turn into adults.
But under complex immigration rules, which Kagan again said parts of which were "through and through perplexing," the government says several thousand other visa applicants age out of the process each year. Some immigration groups had argued that could extend the wait in some cases by nearly a decade.
The federal Immigration and Nationality Act allows U.S. citizens and lawful permanent resident aliens to petition for certain family members to obtain visas to immigrate to the country or to adjust their status to that of a lawful permanent resident alien.
As Kagan observed, "All of this takes time - and often a lot of it ... and as the years tick by, young people grow up, and thereby endanger their immigration status."
Chief Justice John Roberts agreed the board's conclusions were reasonable, but he and Justice Antonin Scalia had a different idea of what made the law "ambiguous" in the first place.
Justice Sonia Sotomayor was among three other colleagues who disagreed with the majority.
"Because the court and the BIA ignore obvious ways in which [federal law] can operate as a coherent whole and instead construe the statute as a self-contradiction that was broken from the moment Congress wrote it, I respectfully dissent," she said.
Justices Samuel Alito, Stephen Breyer and Clarence Thomas also separately dissented.
Several current and former members of Congress had also opposed the administration's interpretation of the rules.
Democratic Sens. Dianne Feinstein of California and Robert Menendez of New Jersey, along with Republican colleagues John McCain and Orrin Hatch, were among 26 lawmakers who said the 2002 law they promoted would preserve family ties and not unfairly punish children who patiently waited for a visa.
Current efforts at broader immigration reform have stalled in Congress.
The case is Scialabba v. De Osorio (12-930).