The Morrison government has bought itself more time to oppose the bill, but still faces the prospect of a historic Lower House defeat come February.
The Morrison government will face a knife-edge vote on a bill to give doctors new authority to order the medical transfers of asylum seekers held on Manus Island and Nauru almost as soon as parliament resumes in February.
On the last sitting day of 2018, the government narrowly avoided a historic loss in the House of Reps by filibustering the debate in the Senate.
Prime Minister Scott Morrison said he would do whatever he could to stop the bill passing, accusing Labor and the crossbench of “watering down” Australia’s strict offshore detention regime.
In the end, a crossbench bill co-sponsored by independent Tim Storer and the Greens passed the Senate. But the bill cannot become law until it passes the House of Representatives, which was already preparing to rise for the Christmas break.
“We got changes through the Senate today. We now have to wait until February to get a better system for medical transfers from Manus and Nauru,” said independent MP Kerryn Phelps in a message posted on Twitter.
Ms Phelps' vote will be critical to the bill passing.
The parliament will resume for two short weeks in February next year before a scheduled budget in April, then a federal election expected in May.
The timing prompted some Labor strategists to theorise that the Prime Minister might call an early election in March to avoid an embarrassing loss right before an electoral campaign.
On Thursday, Mr Morrison launched an extraordinary attack on opposition leader Bill Shorten, saying he was a “clear and present threat to Australia’s safety”.
Mr Shorten said a government he led would maintain Australia’s offshore processing centers on Manus and Nauru, as well as the policy of turning back boats.
But he said the opposition was committed to the medical transfer legislation and finding new solutions, including extra third-country options, to get genuine refugees off the islands sooner.
"It is not an automatic correlation that you can only deter people smugglers by keeping people in indefinite detention," he said.
"That is not the Australian way."
The bill would allow two doctors to authorise a medical transfer from Manus Island or Nauru to Australia, if they believed they could not get adequate treatment offshore.
Labor agreed to support the laws after Senator Storer amended the bill so that the Home Affairs Minister still needs to sign off on each transfer, but explain any refusals to the parliament.