The Australian parliament has passed a bill giving doctors greater say over medical transfers for refugees, the first time a government has lost a vote on its own legislation in the country for almost 80 years.

It means that doctors at Australia‘s processing centres on the Pacific islands of Nauru and Manus Island will be able to force through medical evacuations against the government’s wishes, as long as the patient meets a set of criteria.

Previously, the decision of whether to allow a medical transfer to the mainland was entirely at immigration officials’ discretion. The prime minister, Scott Morrison, said the bill would “take control from the government”, and “unleash a world of woe”.

The change was forced into a broader government bill on border security, as a series of amendments proposed in the Senate and supported by the opposition Labor party.

And by just 75 votes to 74, the government has now been defeated on the bill in the House of Representatives.

Tens of thousands protest against Australia Day Show all 8 1 /8 Tens of thousands protest against Australia Day Tens of thousands protest against Australia Day Invasion Day protesters march down a street during Australia Day in Brisbane, Australia. EPA Tens of thousands protest against Australia Day Invasion Day protesters march down a street during Australia Day in Brisbane, Australia. EPA Tens of thousands protest against Australia Day Invasion Day protesters march down a street during Australia Day in Brisbane, Australia. EPA Tens of thousands protest against Australia Day Invasion Day protesters march down a street during Australia Day in Brisbane, Australia. EPA Tens of thousands protest against Australia Day Invasion Day protesters march down a street during Australia Day in Brisbane, Australia. EPA Tens of thousands protest against Australia Day Invasion Day protesters march down a street during Australia Day in Brisbane, Australia. EPA Tens of thousands protest against Australia Day Invasion Day protesters march down a street during Australia Day in Brisbane, Australia. EPA Tens of thousands protest against Australia Day Protesters shouts slogans as they march through the streets of Sydney in an "Invasion Day" rally on Australia Day. AFP/Getty Images

“This was never about politics,” said Shayne Neumann, the shadow minister for immigration and border protection. ”This was about doing the right, decent and humane thing.”

Bill Shorten, the Labor leader, said the amended bill "ensures that people in Australia’s care can get urgent medical treatment when they need it".

The defeat calls into question the grip on power of the coalition government, led by Mr Morrison's centre-right Liberal party.

The last time a government lost a major vote on its own legislation was in 1941, according to the Sydney Morning Herald, when the House agreed to an opposition amendment to a budget appropriation bill. It spelled the end of prime minister Arthur Fadden’s 40-day term.

In a news conference after the vote on Tuesday evening, Mr Morrison told reporters that "votes will come and they will go, but they will not trouble me".

"My job has been to seek to prevent those bills passing. My job now is to work with border and security agencies to mitigate the risks of these bills," he said.