The Morrison government has suffered an historic defeat, losing the first substantive vote on the floor of the House of Representatives since 1929, after Labor and the crossbench stared down a bare-knuckle tactical offensive by the Coalition, including late advice that the medical evacuations bill was unconstitutional.

The bill cleared the House after a day of high brinksmanship in Canberra, which started with backroom negotiations between Labor and key crossbenchers to adjust legislation passed by the Senate last December, and culminated with the government producing advice from the solicitor general that the proposal breached section 53 of the constitution.

As the major parties faced off in a brutal power play in the House, the constitutional law expert Anne Twomey said the Coalition’s tactics to avoid losing the vote risked elevating the issue to one of confidence.

Twomey said the Coalition’s assertion that the medevac bill was a money bill made it more likely its successful passage could be considered a de facto vote of no confidence in the government – an analysis the government categorically rejects.

Government loses 'de facto confidence' vote as amended refugee medevac bill passes – politics live Read more

“If the bill actually gets passed against the wishes of the government, that would be an indication that the government has lost control over the finances of the country,” Twomey told Sky News.

The advice from the commonwealth solicitor general, tabled by the Speaker of the House, Tony Smith, against the wishes of the attorney general, Christian Porter, was that the proposal before the House breached the constitution because amendments passed by the Senate last December increased expenditure from a standing appropriation in breach of section 53.

But the legal advice also noted that parliament and not the high court was the final arbiter on the proposal before it, in essence reinforcing the discretion of the parliament to chart its own course.

Play Video 0:38 The moment the government lost the medevac bill vote – video

Staring down the government’s frantic efforts to head off the historic defeat, Labor produced a last-minute amendment ensuring that members of a newly created medical panel overseeing medical transfers of people from offshore detention would not receive any remuneration for their service, therefore bypassing the constitutional problem.

Crossbenchers who supported the proposal also remained firm in the face of the concerted government fightback, and stuck through a series of votes to pass the proposal the group had agreed with Labor and the Greens over the course of Tuesday.

Despite the setback, the prime minister, Scott Morrison, remained resolutely on the political offensive, declaring that the vote demonstrated Labor had failed to learn the lessons from of the past. He said Australia’s border protection regime could not be adjusted without serious consequences.

Labor extends lead over Coalition 55%-45%, Guardian Essential poll shows Read more

Setting up a swingeing election battle on border protection, Morrison said the events of the day demonstrated Labor did not have the “mettle” to do what was necessary to protect Australia’s borders, and could not be “trusted” to stop the deaths at sea.

“Australia cannot trust Bill Shorten to make Australia stronger,” the prime minister said. “Every [boat] arrival is on Bill Shorten’s head.”

Morrison said contingency plans had been put into place to manage the “risks” to the regime that Shorten and the crossbench had created, and the home affairs minister was already meeting with border command.

The Labor leader said ensuring that people in offshore detention had access to proper medical treatment was a test of national character, not a sign of weakness. “This bill and the amendments are about character,” Shorten told the House. “It is about how we treat sick people in our care.”

The amendments agreed between Labor and the crossbench widen the discretion of the home affairs minister to stop medical transfers if asylum seekers pose a security risk or have serious criminal records.

Privileged sport officials willing to sacrifice Hakeem al-Araibi's life should be expunged | Craig Foster Read more

The package also gives ministers 72 hours to make decisions, rather than the original proposal of 24 hours. It also limits the new procedures governing medical transfers to the cohort already on Nauru and Manus Island.

Morrison declared the defeat, which he said he had anticipated, was not a de facto motion of no confidence in the government, and he was confident that the independents would continue to support the government. He said he had no intention of going to the polls early, and the election would be in May.

There has been speculation that the government may decline to take the proposal for royal assent by the governor general, assuming it clears the Senate.

The manager of opposition business, Tony Burke, told reporters if the government pursued that course of action it would be “extraordinary and without precedent”.

Morrison ruled that out categorically on Tuesday night, saying the normal processes would be followed.