Australian MPs have passed a landmark bill with an opposition amendment making it easier for sick refugees held offshore to be treated in the country.
This is the first time in decades a government has lost a vote on its own legislation in the lower house.
The move is a blow for Prime Minister Scott Morrison's minority government's highly controversial immigration policy.
Since 2013, Australia has sent asylum seekers arriving by boat to detention centres on Nauru and Papua New Guinea. Critics say it has harmed the welfare of detainees, including children.
Doctors have long warned of inadequate medical facilities on the islands, while the United Nations has previously described the camp conditions as "inhumane".
However, Mr Morrison said: "There is no form of this bill that does not weaken our border protection."
Australia has long defended its offshore detention policy by arguing that it stops deaths at sea and disrupts the trade of people smuggling.
The bill passed in the House of Representatives by one vote after the Labor opposition and crossbench MPs agreed on last-minute amendments.
It is expected to sail through the upper Senate later this week where it will become law.
It's hugely significant that a government has lost a key parliamentary vote in its lower house - this hasn't happened in almost 80 years, according to the Australian Broadcasting Corporation and comes ahead of a federal election later this year.
The defeat comes as a blow to Mr Morrison, Australia's sixth prime minister in six years, and raises questions about whether he can remain in office. The government lost its majority late last year after losing a by-election.
But Mr Morrison has ruled out a snap election, saying last week that he wouldn't "be going off to the polls" even if he lost the "stupid" bill.
"Votes will come and go, they do not trouble me," he said today after the government's defeat. "The Australian people can always trust us to... ensure the integrity of our border protection framework."
Mr Morrison's coalition government has to call an election by May.
Provisions of the bill
Doctors will now have the power to recommend transfers for refugees on Nauru and Manus to Australia for treatment. However, the immigration minister could ask an independent panel to review the medical assessment, and would have some authority to overrule it.
Previously, doctors had reported that their medical transfer recommendation were ignored by authorities.
Refugee lawyers thus had to apply for court orders to bring ill people to Australia. There were 44 medical transfers achieved through court battles.
Last year, Australians were horrified by reports of a mental health crisis among children in detention. Doctors reported affected children too depressed to eat or sleep, and attempts of suicide among those as young as 11.
The wave of public backlash pushed the government to evacuate more than 100 children and their families from Nauru to Australia.
Advocates warned that a similar mental health crisis, and a plague of other medical issues, was also constant among the 1000 adult detainees stuck on Nauru and Manus Island.
In one of several high-profile cases, an inquest last July found that the death of Iranian refugee Hamid Khazei on Manus Island from a foot infection could have been prevented if he had been transferred to Australia earlier for medical treatment.
In a public letter to MPs this week, Doctors4Refugees, an advocacy group of physicians, identified dozens of sick refugees who had received inadequate treatment. These included "life-threatening" heart conditions, kidney stones, tuberculosis and diseases common in the sub-tropical environment, such as malaria, dengue fever and chronic fungal infections.
Refugees on the islands, including Manus refugee award-winning author Behrouz Boochani, have said they were pinning their hopes on the vote.
Its a historical moment for all of the refugees on Manus and Nauru. Many people are happy now because they will finally receive medical treatment. Great to see the Australian parliament finally vote for humanity.#Manus
— Behrouz Boochani (@BehrouzBoochani) February 12, 2019
- BBC