Labor and the Coalition have come to an in-principle agreement on the government’s bill to give law enforcement agencies access to encrypted communication.

In a deal between the attorney general, Christian Porter, and his shadow, Mark Dreyfus, the government has agreed to limit the powers to investigation of “serious offences” and add new safeguards to agencies’ ability to demand tech companies build backdoors into their products.

The deal paves the way for the telecommunications assistance and access bill to pass parliament in the final parliamentary sitting week, despite a breakdown in bipartisanship on Friday when the home affairs minister, Peter Dutton, blamed Labor for failing to support the bill.

Porter confirmed the “fundamental resolution” with Labor, telling reporters it was a “massive win for the Australian people” that would allow agencies to break encryption to police serious crimes.

Serious crimes are defined as all terrorism and child sex offences or other offences with a term of imprisonment of three years or more.

Under the terms of the deal, law enforcement agencies will not be able to issue technical capability notices for companies to build back doors unless both the attorney general and communications minister approve.

The bill will contain a definition of “systemic weakness” – which companies cannot be asked to create – and stipulates that disputes about what constitutes such an impermissible back door will be determined by a former judge and a person with technical expertise.

The committee will continue to scrutinise the bill in 2019, but Labor has retreated from its suggestion that an interim bill should be passed limiting the number of agencies that will gain access to new powers.

Porter said an interim bill would have been “substantially ineffective” because state police would not have access to the powers over summer.

He revealed that state anti-corruption bodies had been removed from the list of agencies that could access the new powers.

The government now expects the bill to pass this week and has listed it for debate on Wednesday.

Dreyfus said the government had made “important concessions” to ensure “better oversight and limitation of the powers in this bill, and better safeguards against potential unintended consequences”.

“Labor has spent five years responsibly improving national security legislation to make Australians safer, and we have done the same thing today,” he said.

“Importantly, the PJCIS will continue its scrutiny of the bill into 2019, allowing for outstanding concerns to be worked on and further amendments introduced in the new year if necessary.”

Dreyfus said the bill was still “far from perfect and there are likely to be significant outstanding issues”.

“But this compromise will deliver security and enforcement agencies the powers they say they need over the Christmas period, and ensure adequate oversight and safeguards to prevent unintended consequences while ongoing work continues – just as Labor proposed.”

The Greens digital rights spokesman, Jordon Steele-John, has warned that “not only will this terrible legislation infringe on the rights of every Australian, but will make it easier for sensitive info to be hacked and/or exploited”.

The Ai Group’s chief executive, Innes Wilox, said: “The limitations on what alleged criminal activity would be covered by the legislation appear to go some way to addressing a number of the concerns raised by business and the community.”

“Protecting the security of communications and information between businesses and their customers is of fundamental importance.

“This legislation must not make businesses more vulnerable to hacking nor undermine their customers’ trust.”

Communications Alliance chief executive John Stanton said the definition of systemic weakness should “not be so narrow that it allows substantial and dangerous back-doors to be ordered by enforcement agencies and yet escape being identified as systemic weaknesses”.

Scott Morrison and Dutton had demanded Labor pass the bill in the last fortnight of parliament, which led to further hearings in which spy agency Asio chief Duncan Lewis said the legislation was “urgent” because there were “cases afoot” which the new powers would assist as the risk of terrorism increased over the Christmas period.

The home affairs minister had incorrectly claimed that Labor opposed the bill, earning a rebuke from the former national security legislation monitor Bret Walker for characterising calls for more scrutiny as opposition to national security.

Dreyfus accused Morrison and Dutton of “extraordinary interference” but welcomed constructive negotiations with the attorney general.

“I want to issue a call to the government – the trashing of bipartisan process and politicisation of national security that has occurred over the past month must never happen again.

“There is nothing more important than keeping Australians safe – the government must remember that.”

Porter said that the prime minister and government’s interest was always “to protect the Australian people from terrorists, murderers and paedophiles” and thanked Dreyfus for constructive negotiations.