Immigration Minister Scott Morrison says 31 babies born to asylum seekers can stay in Australia despite a Federal Court ruling.
A baby born in Brisbane to asylum-seeker parents can stay in Australia despite the Federal Court upholding a decision not to allow the boy to apply for a protection visa.
The Australian government had said Ferouz could not apply for a protection visa because he was an unauthorised maritime arrival, a stance that was upheld by the Federal Circuit Court in October.
It was again upheld by the Federal Court in Brisbane on Thursday following an appeal by lawyers for Ferouz's family.
However, just before the judgment was handed down, Immigration Minister Scott Morrison announced that 31 babies, including Ferouz, and their families would not be transferred back to the Nauru detention centre.
"Today is a very joyful day for my whole family," Ferouz's father, who cannot be named, said in a statement.
"I have never known such joy in my whole life."
They will instead be able to apply for protection visas and can remain in Australia at least until they have been assessed.
Mr Morrison's office said the court ruling can not change his decision.
"It will have no effect on the decision of the government. The commitment will be implemented," a spokesman said in a statement.
Mr Morrison says the babies' claims for refugee protection will be assessed as part of a legacy caseload of 30,000 asylum seekers who arrived under the previous Labor government.
Eighty family members related to the babies will also get to stay in Australia.
The minister said it was a "special one-off arrangement" and pregnant asylum seekers transferred to Australia who had not given birth before Thursday would be returned to Nauru.
Senate crossbencher Ricky Muir won the concession from Mr Morrison in exchange for his support of controversial migration law changes that passed the upper house in December.
Baby Ferouz was born last year in Brisbane's Mater Hospital to Rohingya parents from Myanmar, who arrived on Christmas Island in September last year.
The boy's mother, Latifa, was flown from Nauru to Brisbane to give birth after complications during pregnancy.
The Australian government argued Ferouz could not apply for a protection visa because he was an unauthorised maritime arrival.
Laws introduced last year mean asylum seekers who arrived by boat after July 19, 2013, can't claim protection visas.
Law firm Maurice Blackburn, which represents Ferouz's family and other asylum seeker babies, welcomed the minister's announcement on Thursday.
Senior Associate Murray Watt said the change of heart by the minister would spare the 31 children from the "inhumane" conditions on Nauru.
Mr Watt said it was important to note that the babies and their families faced other hurdles as they still need to have their visa applications considered, and any visa would only be temporary.
"However, they at least now have that right and do not face imminent removal to Nauru," he said.
It isn't yet known whether Ferouz and his family will remain in detention until their visas have been assessed or released on bridging visas.