Australia's parliament has passed a bill to force tech firms such as Google, Facebook and Apple to give police access to encrypted data, the most far-reaching such requirements imposed by a western country.
The bill, staunchly opposed by the tech giants which fear Australia could be an example as other nations explore similar rules, is set to become law before the end of the year.
"Let's just make Australians safe over Christmas," opposition Labor party leader Bill Shorten told reporters outside parliament in the capital of Canberra.
The bill, passed by the lower house of parliament earlier on Thursday, was to be debated in the upper Senate, where Labor said it intended to suggest new amendments, before going back to the lower house.
In an eleventh-hour twist, Labor said that despite its reservations, it would pass the bill in the Senate, on the proviso that the coalition agreed to its amendments next year.
"We will pass the legislation, inadequate as it is, so we can give our security agencies some of the tools they say they need," Shorten said.
The bill provides for fines of up to $10 million for institutions and prison terms for individuals for failing to hand over data linked to suspected illegal activities.
When it becomes law, Australia will be one of the first nations to impose broad access requirements on technology firms, after many years of lobbying by intelligence and law enforcement agencies in many countries, particularly the so-called Five Eyes nations.
The Five Eyes intelligence network, comprised of the United States, Canada, Britain, Australia and New Zealand, have each warned that national security was at risk because authorities were unable to monitor the communications of suspects.
Australia's government has said the laws are needed to counter militant attacks and organised crime and that security agencies would need to seek warrants to access personal data.
Technology companies have opposed efforts to create what they see as a back door to users' data, a stand-off that was propelled into the public arena by Apple's refusal to unlock an iPhone used by an attacker in a 2015 shooting in California.
The companies say creating tools for law enforcement to break encryption will inevitably undermine security for everyone.
Representatives of Google, Amazon and Apple were not immediately available for comment after the Senate vote.
Earlier on Thursday, a Facebook spokesman directed Reuters to a statement made by the Digital Industry Group Inc (DIGI), of which Facebook as well as Apple, Google, Amazon and Twitter, are members.
"This legislation is out of step with surveillance and privacy legislation in Europe and other countries that have strong national security concerns," the DIGI statement said.
"Several critical issues remain unaddressed in this legislation, most significantly the prospect of introducing systemic weaknesses that could put Australians' data security at risk.”
(Reporting by Tom Westbrook and Karishma Luthria. Additional reporting by Melanie Burton in MELBOURNE; Editing by Paul Tait and Darren Schuettler)