The opposition’s security briefing on the implications of the so-called medivac bill early this week confirmed the one thing Opposition Leader Bill Shorten and his senior colleagues feared: as drafted, it could be a direct incentive for people to set sail for Australia and try to claim asylum.

The advice prompted Labor to produce an amendment restricting medical transfers to those asylum seekers and refugees already on Manus Island or in Nauru.

After the amendment was drafted, the security advice about the legislation being a direct incentive – or “pull factor” – changed.

Emerging from his subsequent briefing on Wednesday morning to cast the deciding vote in the senate, Justice Party senator Derryn Hinch said adding the restrictive amendment had persuaded him to back the bill.

Hinch told parliament: “It’s not an encouragement, I believe, to people smugglers, who are despicable and should be despised, because it will only apply to people who are there.”

He attributed his change of heart to assurances from the Department of Home Affairs, including that those transferred would “not come here and wander around the streets of Australia – they will come here for medical attention”.

But security agencies still believe it’s a potential problem. And that has given the government licence to seize on the issue as a political weapon and its best hope of clawing back enough public support to be re-elected.

As parliament resumes for the year, the passage of the independents’ medivac bill with Labor’s support has seen the clearest battleline yet drawn between the opposition and the government ahead of the looming federal election.

It has delivered Prime Minister Scott Morrison both what he fought to avoid and also what he most wants.

The former is the vivid reminder of the Coalition’s flimsy grip on power, in the form of the first legislative defeat of an incumbent government in many decades, forcing it to implement a law it opposes.

But that same defeat gives Morrison the opportunity to run a full-throated campaign against Labor on border protection, with echoes of the devastating one his predecessor, John Howard, ran against Kim Beazley in 2001.

The argument goes that the transfers would prove there was no longer any credibility in prime minister Kevin Rudd’s 2013 promise that future asylum seekers coming by boat would never set foot in Australia.

Morrison’s opening salvos this week lifted the spirits of demoralised Coalition MPs, as he adopted Howard’s scathing character assessment of Beazley and turned it on his own opponent.

“You’ve got to have the mettle, you’ve got to have the ticker, you’ve got to have the resolve to actually see things through and implement these decisions and not roll over to whatever wind might blow your way to make you compromise Australia’s national security and trade it away,” Morrison told parliament on Thursday.

Bill Shorten insists he is not concerned.

“I think this country in 2019 is not the same nation as 2001,” Shorten said on Thursday. “I do not believe that Australians want a government which governs by slogans and fear.”

Morrison is understood to be the architect of his own political strategy. His friend, former Howard adviser turned lobbyist David Gazard, confirmed the prime minister is choosing to see the medivac legislation as a gift.

Gazard told Sky News this week: “I reckon it’s ‘make my day’ [for] Scott Morrison.”

Labor is acutely aware that it bungled refugee policy when previously in office, leading to a dramatic increase in the number of asylum seekers heading for Australia by boat, including those still languishing on Manus and Nauru. Its leaders in both the right and left factions are determined not to repeat that. At the same time, its core constituents are demanding a much greater emphasis on compassion.

So, while it is politically dangerous for Labor to have backed the medivac bill, it could not have afforded to oppose it.

Like Morrison, Labor’s leadership is choosing to see this as an opportunity, not a problem.

It wants to send a clear message to those same supporters that while having a heart is important, a Labor government is not about to dismantle border protection measures a second time.

“Under a government I lead, we will turn back boats where it is safe to do so,” Shorten said this week. “People who seek to come to Australia by boat will go to Nauru and will be regionally processed to third-party nations.”

Shorten says the price of maintaining strong borders does not need to be the inhumane treatment of people who seek asylum.

He accuses the government of trying to “whip up fear and hysteria” and encourage people smugglers to entice people onto boats, suggesting the foreshadowed reopening of the Christmas Island detention centre is part of that.

Experts say Morrison’s commitment to reopening Christmas Island is based on the fact it is an Australian territory. Those cleared to be medically transferred to Australia under the new legislation, and not requiring high-level specialised care, will likely find themselves transferred there rather than to the mainland.

That is designed to make medical transfer a less attractive option.

Some observers also highlight the difficulty in Shorten’s third-countries promise: aside from the limited offers from New Zealand and a reluctant United States, third countries do not want to resettle the refugees Australia are refusing.

Equally, experts say the rhetoric coming from Morrison and his colleagues is overblown.

Some who have been deeply engaged with these issues say neither side is telling the whole story.

One seasoned observer tells The Saturday Paper: “The situation is not as catastrophic in the near term as the government would portray. But neither is it as benign as the opposition would suggest.”

What apparently did not change in the agencies’ advice after the amendments were drafted was a warning that the legislation would lead eventually to all of the humanitarian claimants on Manus and Nauru coming to Australia citing medical need.

This is because the legislation allows transfers for medical “assessment” as well as treatment.

The Minister for Home Affairs can still veto applicants who pose a security threat or whose medical condition is in dispute, sending the application to a newly established independent panel for review. But the medical veto time limit, extended in the amendments from 24 to 72 hours, contains a clause that deems applications automatically approved if it’s not met.

If hundreds of applications are lodged at once, as the government fears they will be, the deadline could be difficult.

While this is the outcome some refugee advocates seek, government advisers warn it could herald a resumption of boat arrivals.

The argument goes that the transfers would prove there was no longer any credibility in then prime minister Kevin Rudd’s 2013 promise that future asylum seekers coming by boat would never set foot in Australia.

It continues that this reinforces to people smugglers and asylum seekers that Australia’s laws are subject to change and reduces to virtually zero the deterrent effect of the now-empty regional processing centres – the final two people at the Nauru centre are understood to have moved into the community this week.

On this basis, the government fears it has only one line of defence left in trying to stop people coming on boats: turning them back and flying rejected asylum seekers to their home countries, where possible.

Its agencies are warning that if one boat gets past the Australian Border Force, others will follow and an influx would become uncontrollable.

Unconvinced – or unconcerned – that his rhetoric could make the risk greater, Morrison is equating Shorten’s tough assurances to those of Rudd.

“There is an eerie ring to what we are hearing,” he said.

As Labor and the independents, led by Wentworth MP and general practitioner Kerryn Phelps, seized the legislative agenda and ran away with it this week, Morrison and his colleagues resorted to other tactics.

First, they tried public pressure. Last week, details of a classified security brief on the proposed legislation – before Labor drafted its amendments – were leaked to The Australian newspaper.

In an unusual move, the government later declassified the briefing document and made it available to other journalists, including The Saturday Paper.

The brief said up to 1000 detainees were expected to apply for transfer within four weeks of the legislation becoming law. It noted that many doctors had “called for an end to regional processing” and would likely endorse the applications.

But in a message that appeared to undermine subsequent claims of a pending influx, given it was written before future travellers were excluded from the legal change, it also advised that would-be asylum seekers – “potential illegal immigrants” or “PIIs” – would scrutinise any legal change to ensure it provided a genuine opportunity for them before paying to get on a boat.

“PIIs will probably be interested in any perceived or actual pathway where resettlement in a Western country is guaranteed, even if such a pathway includes a period spent in detention,” the brief says.

“However, PIIs will probably remain sceptical of smuggler marketing and await proof that such a pathway is viable, or that an actual change of policy has occurred, before committing to ventures.”

When neither the declassified brief nor a subsequent higher-level in-person version dissuaded Labor from backing the medivac bill, the government tried to stop MPs dealing with it, producing legal advice from the Australian government solicitor, which said it was unconstitutional.

The advice suggested that because the legislation had come to the house of representatives after being amended in the senate – through independent Tim Storer’s sponsorship – and because it would establish a presumably paid medical advisory panel to adjudicate on transfer applications, the bill could be seen to be a money bill.

Because the constitution requires that money bills originate in the house, it said the legislation was invalid.

Attorney-General Christian Porter sent the advice to Speaker Tony Smith, but asked him to keep it confidential – even from other members of parliament.

In a slap to Porter, Smith refused his request. Deciding MPs needed to be able to see the advice for themselves before voting on the legislation, he tabled it, making it public.

To head off the money bill problem, the legislation was amended to ensure the panel members would be unpaid volunteers. The house then voted and passed it on Tuesday night, with the senate following the next day.

On Tuesday afternoon, editor-at-large of The Australian Paul Kelly gave Sky News his advance take on the eventual outcome.

“It would be an extraordinary, untenable and humiliating event for the Morrison government to have to turn around and implement a policy enacted by the parliament which the government of the day felt was compromising border protection and undermining national security,” Kelly said.

But that’s what happened.

Morrison brushed aside the humiliation and went for Labor on border protection instead.

Minister after minister backed him in, using question time to condemn the opposition as weak and dangerous and putting lives at risk, and reminding Australians of what happened last time Labor was in office.

Veterans Affairs Minister Darren Chester went the furthest, describing in detail how sailors felt rescuing asylum seekers from the ocean when their boats sank.

“Navy personnel talked to me of the sensory overload – the smell of diesel fuel, vomit and rotting wood, children screaming and adults crying,” he told parliament on Wednesday. “I know this is confronting and sickening, but it’s true. This is not about politics. There is nothing humane about policies that lead to people drowning at sea.”

It might also be observed that using the plight of desperate people to prop up desperate political parties does not seem terribly humane, either.