The House of Lords has passed the Investigatory Powers Bill, putting the huge spying powers on their way to becoming law within weeks.
The bill – which forces internet companies to keep records on their users for up to a year, and allows the Government to force companies to hack into or break things they've sold so they can be spied on – has been fought against by privacy campaigners and technology companies including Apple and Twitter.
But the Government has worked to continue to pass the bill, despite objections from those companies that the legislation is not possible to enforce and would make customers unsafe.
The apparently final part of the Government's fight to have the powers passed came as it refused to budge over its proposed new surveillance powers by rejecting for a second time amendments from peers linked to phone hacking.
Solicitor General Robert Buckland insisted it would be "simply not appropriate" to include within the Investigatory Powers Bill changes designed to ensure costs are awarded against newspaper and media organisations in phone hacking cases.
Peers have repeatedly sought to amend the Bill so it implements a key part of the Leveson Inquiry report by offering "protection" over costs for victims of press intrusion.
But MPs voted to reject the latest Lords amendments by 295 votes to 245, majority 50.
A parliamentary process known as ping-pong is ongoing, which sees the Bill move between the Commons and the Lords until a final decision is taken over the text.
It will return to the Lords for further scrutiny.
The Bill gives a range of new powers to access data and internet communications to police and security services.
Elsewhere, ministers are also conducting a 10-week consultation which includes examining whether to implement legislation which would force newspapers to pay all of the costs of libel or privacy actions brought against them - even if they win their case.
This would not apply to publications which sign up to a new state-backed press regulator.
Mr Buckland reiterated this consultation "speaks directly to the concerns" of those who support the Lords amendments.
He recognised independent crossbencher Baroness Hollins had revised her amendments, but later told MPs: "They have no place in a Bill that relates to the regulation of investigative powers.
"This is all about national security, this is about dealing with crime whether it's child abuse, whether it's trafficking, whether it's drug dealing, whether it's the sort of criminality that we want to deal with in our society.
"That's why these amendments are not only out of place but also they pre-empt the outcome of the consultation launched by (Culture Secretary Karen Bradley)."
Tory MP Jacob Rees-Mogg (North East Somerset), intervening, said: "Wouldn't you go further and to say that putting restrictions on the press in a Bill on national security is actually precisely the wrong place to have restrictions on the press - it makes it look as if we're really trying to hit them hard?"
Mr Buckland noted an "important point" had been made.
Shadow home secretary Diane Abbott backed the changes proposed by peers, telling the Commons: "I believe any member of the public who just heard the speech from the Government benches will be puzzled as to the Government's continuing resistance to implementing an aspect of Leveson that it, in principle, agreed to some time ago.
"Labour fully supports this set of amendments to the Investigatory Powers Bill and on this side of the House we have consistently and genuinely called for the Leveson recommendations to be implemented in full."
SNP justice spokeswoman Joanna Cherry also supported the amendments and said: "Those who have not hacked, do not hack phones and do not intend to hack telephones or indeed emails have nothing to fear from these provisions."
But Mr Rees-Mogg said: "This is an absolutely dreadful amendment. It should be thrown out, rejected, sent back to the House of Lords.
"It is fundamentally wrong. It seeks to punish those who may be innocent, to fine them for telling the truth, for saying things that people in power do not like.
"It goes to the heart of our free press and it should be thrown in the bin."
Additional reporting by agencies