Amendments to the Migration Act have passed Australia's House of Representatives which could make it easier for sick refugees detained on Manus Island and Nauru to be transferred to Australia for medical treatment.
The changes were part of the Urgent Medical Treatment Bill, the passage of which marked the first time in 90 years an Australian government had lost a substantive vote in the house.
The bill, which must be approved by the Senate before it becomes law, would give a panel of two doctors the power to approve transfers from offshore detention.
The Home Affairs Minister would have 72 hours to decide whether to block a transfer, which they could only do on national security grounds, or if the person seeking transfer has a criminal record and poses a risk to the community.
Currently, a panel comprised mostly of bureaucrats is responsible for transfer decisions.
Doctors, lawyers, advocates and clergy say many refugees have been waiting years for medical intervention not available where they are detained.
About 1,200 refugees are estimated to be in exile in Nauru and Papua New Guinea's Manus, where they've been indefinitely detained for almost six years.
Hugh de Kretser, the executive director of Australia's Human Rights Law Centre, said the bill's passage was the result of MPs working across the floor to ensure "a humane solution".
"The current medical transfer system is broken. People needing urgent medical assistance have severely deteriorated and even died. Notably, the coroner found that the death of young man, Hamid Khazaei, was caused by medical failure and delays," Mr de Kretser said.
"We need to stop risking lives. We now call on the Senate to pass this bill as soon as possible."
Kelly Nicholls from the Refugee Council of Australia said doctors' advice on medical transfers should be paramount.
"The safety of lives must always come first. Doctors have been ignored for too long. People have died as a result," Ms Nicholls said.
"Pregnant women with complications have had to wait dangerously long to receive the treatment they need. Rape survivors have to had to have traumatic late term abortions due to government blocks," she said.
"This bill changes the response to medical emergencies in offshore detention on Manus Island and Nauru."