According to close sources, the pair spoke multiple times - including about their duties as doctors - and reached an understanding. Phelps had already expressed her strong desire to take action on Nauru and Manus Island. She told the Greens leader she would declare climate change and refugees her top priorities. Di Natale then publicly backed Phelps for Wentworth, noting her progressive stance on those two key issues. He signalled voters should ignore the instructions of the NSW Greens. Phelps denies any sort of deal took place with Di Natale, and stresses the plight of refugees offshore has always been one of her priorities. "This is not a new thing for me," she says. Crossbench MP Kerryn Phelps and independent senator Tim Storer worked closely on the amendments. Credit:Alex Ellinghausen In the end, Phelps won Wentworth by a small margin, plunging the Morrison government into minority. She went to Canberra with just months to get on the political scoreboard and prove she could exploit the numbers to get stuff done.

Phelps put up a private member's bill to empower two doctors to evacuate a refugee from Nauru or Manus Island, but it quickly became clear it would go nowhere. The government would never let it be debated - and Labor wouldn't support it because it was too broad. Loading But the Greens had also been sitting on a secret plan. A refugee proposal could be "tacked on" to a related government bill in the Senate, which if passed, would be automatically debated in the lower house, owing to the quirks of parliamentary procedure. In the final days of Parliament last year, urgent discussions began. The consensus was that an independent should take the lead. Tim Storer, a little-known South Australian senator, stepped up. Two young lawyers - Byron Fay in Storer's office, Charlotte Hanson from Phelps' - worked hard on the terms. Refugee advocates were closely involved in the process. One of the key participants was Quinton Clements, government relations manager for World Vision and a former senior adviser to two Senate presidents: Labor's John Hogg and the Liberals' Stephen Parry.

Labor's backing was essential. According to several sources, immigration spokesman Shayne Neumann started from a hard line, insisting the minister be able to reject any transfers on character grounds. He later relented. Under the agreed terms, two doctors would be able to compel the minister to transfer a sick refugee to Australia. If the minister disagreed, it would go to a doctors' panel overseen by the government. The minister could overrule the panel, but only on security grounds and only within 24 hours. These amendments to the government's miscellaneous home affairs bill scraped through the Senate just before 5pm on the final sitting day of 2018. After a marathon filibuster from Cory Bernardi and the government, it was too late to go to the House. But the threat hung over the long summer break, fuelling rumours Scott Morrison would call an early election rather than let Parliament return and suffer a humiliating defeat. Peter Dutton warned the Phelps proposals would undermine Operation Sovereign Borders and restart the boats. Credit:Dominic Lorrimer

The government had different ideas. It commissioned two pieces of advice: one, from the Home Affairs department, on the security implications of the medical transfers proposal. Another, from the solicitor-general, on the constitutionality of the amendments. The classified Home Affairs advice somehow made its way to News Corp newspapers. Peter Dutton says neither he nor his office were responsible. The Solicitor-General's contribution, sought on February 6 and provided the next day, was kept under wraps as a last resort. Dutton argued Shorten and Labor had either ignored, or never sought, security briefings on the proposed law. If they had, he said, they would have learnt it would unravel the "third pillar" of Operation Sovereign Borders. The government declassified the advice as proof. It was clear Labor had a problem. Shorten publicly flagged he was prepared to compromise. Left-wing MPs were anxious when two high-profile journalists, Annika Smethurst and David Speers, used their Sunday columns to predict a Labor backflip. Labor leader Bill Shorten signalled early on that the party was preparing to compromise. Credit:Alex Ellinghausen

But Labor's Left faction pushed back too, pointing out the party committed to the policy at its national conference in December. It was locked into the platform. And what message would it send if Labor abandoned a bill it had voted for just two months before? By the time MPs flew into Canberra for the start of the parliamentary year, it was clear there was going to be a negotiation of sorts. The challenge was to land on something everyone could live with - including the Greens and the crossbench. On Monday night, Labor produced two documents: a set of general principles about what a revised bill should look like, and three pages of detailed amendments. Loading Replay Replay video Play video Play video When crossbenchers met in Phelps' parliamentary office at 9am on Tuesday, they agreed the amendments were too onerous. But the principles offered room to move. At 10.15am, they sat down with Shorten and Penny Wong in the Opposition Leader's office and kicked off talks.

The discussions were cordial and outcome-focused, notwithstanding a well-timed television appearance by Di Natale just after 11am in which he refused to support Labor's version. He had agreed this "announcement" with his key negotiator, Adam Bandt. Labor dismissed it as "grandstanding", insisting a deal was still under way. As the storm picked up outside, the clerks were in overdrive drafting the final version of the bill. In a post-question time surprise, Attorney-General Christian Porter whipped out the Solicitor-General's advice from his back pocket - but to no avail. The agreed compromise whisked through the House by a single vote, 75 to 74. Later, up in Phelps' office, crossbenchers drank Aldi champagne. But there was still one more hurdle to clear: Derryn Hinch. The Victorian senator voted for the bill last year, but now he had his doubts. Dutton visited him in his office at 8.15am to make the government's case. Just before 8.30am, Hinch walked into the cabinet room in the ministerial wing to be briefed by Home Affairs. If anything, the bureaucrats convinced him the bill was OK. The refugees would remain in detention or under armed guard. And only those 1000 people currently on Manus or Nauru would be eligible.