The family of Rohingya asylum seekers at the centre of controversy over the government’s Operation Sovereign Borders policy have won a temporary reprieve to stay in Australia and plead their case, after successful out-of-court negotiations with the immigration department.

In October Guardian Australia revealed that 31-year-old Latifar was being held on Nauru while pregnant and suffering diabetes. At the time she believed she was going to have twins. Medical experts expressed “serious concerns” about the high-risk case.

Latifar, her husband and other child were transferred to mainland detention and it was revealed by Fairfax that the baby, Ferouz, was born in Brisbane’s Mater hospital but needed round-the-clock care due to respiratory problems. Ferouz was kept in the hospital separated from his mother who was sent back to detention for 18 hours a day.

A Brisbane court was expected to hand down a decision on Friday on the fate of the family who were seeking an injunction to prevent the immigration department transferring them back to Nauru before their newborn child is well, but instead an agreement was reached during negotiations with the immigration department.

The family’s legal team was challenging the right of Australian authorities to send baby Ferouz offshore, claiming that as he was born in Australia to essentially stateless parents, he should be given the same rights as any Australian child and has a claim to citizenship.

Lawyers for immigration minister Scott Morrison challenged the jurisdiction of the court to make any such injunction, but agreed after the case was adjourned on Tuesday not to transfer the family while the case was still before the court.

The negotiations have since resulted in a deal with the immigration department, allowing the family to remain in the country while they “argue their case with procedural fairness”, including presenting independent medical evidence about Latifar and Ferouz’s conditions in front of the immigration department.

Maurice Blackburn associate Murray Watt said the family had “finally been offered natural justice”.

“All we have argued is that the family had a right to be heard, and that they should not be taken to Nauru without being afforded that basic process of fairness,” Watt said in a statement.

“The federal government has now conceded that baby Ferouz and his family deserve that right. The department has now set a standard, in granting asylum seekers who are brought to Australia for medical treatment, a fair hearing before being returned offshore.

“We expect the federal government to undertake this process in good faith to make sure Ferouz and his family are treated fairly.”

As part of the agreement the immigration department must give the family at least two days’ warning if it intends to send them back to Nauru.

“They also deserve the chance to have the government hear the case for Ferouz’s right to citizenship or a protection visa, given he was born in Australia to stateless parents,” said Watt.

Latifa, her husband and their three children remain detained in Brisbane immigration transit accommodation.

At his weekly Operation Sovereign Borders press conference in Sydney on Friday, Morrison said it would not be appropriate to comment on the case before the 4pm hearing.

On Wednesday evening, Burma’s opposition leader Aung San Suu Kyi told an audience that she believed the case of the Rohingya family should be dealt with in the framework of Australian law, and that “justice should always be tempered by mercy”.

As of Friday morning there were currently 668 people on Nauru in the detention facilities.