Kirsty Wigglesworth/AP/Press Association Images. All rights reserved.The last few months have been tumultuous for the UK. The campaigning in the referendum, the shock of the death of Jo Cox MP, the astonishing vote to leave the EU, the collapse of the pound, the fall of the prime minister, leadership contests in the Tories, producing a new prime minister, and in Labour and UKIP – in both cases resulting in the same leader continuing.

However, throughout this process, a crucial piece of legislation has continued to make its way through parliament, avoiding any proper public debate or scrutiny. The Investigatory Powers Bill is sneaking up on the final steps before it becomes law – something that should terrify all of us.

Some of the powers in the Bill are deeply intrusive, and with very little possible justification. All of us want to be safe, and protected from terrorists and the like – but the evidence that these powers are all needed is thin indeed. However, the cost to all of our privacy is huge.

For example, a power the state never had before is to require a log to be kept for a year of every website we ever go to. Just think of that – your browsing history stored, just in case it’s ever useful. If you ever choose to visit a depression support website, would you want that to now be logged, potentially revealing your mental health state? What about an abortion advice site? Marriage guidance? Why does the state need to know this about every one of us?

There are many other problems with the legislation – real threats to tech companies in the UK, risks of inappropriate interference with telecoms equipment, pervasive bulk powers, far too little oversight, and a huge bill.

The previous version of this legislation, the Communications Data Bill, was killed off in 2013. I was delighted to play a key role in that, and hoped it would be dead and buried. However, since the end of the Coalition, it has returned from the underworld.

This version of the legislation was first produced as a draft at the end of last year, and was promptly slated by every committee that studied it. The government then made a tiny handful of cosmetic changes to it – most infamously, inserting the word “privacy” into the title of one section, rather than actually doing something to support privacy – and then pushed it through the House of Commons.

The pattern of debate in the Commons was depressing. The SNP and Lib Dems stood firm, with help from the Greens and Plaid Cymru – but with Labour absent from almost every vote, there was no chance of making any significant progress. And then at the final stage, the crucial decision as to whether the House of Commons did want to endorse unprecedented powers to spy on its own citizens, Labour did finally show up – to vote with the Tories.

Their excuse was that the government had agreed to include protection from state surveillance for trade union activities. I agree that we shouldn’t have unjustified spying on trades unionists – but surely we shouldn’t have it for anyone else? What possible reason could there be for special protection?

We then move to the House of Lords. Surely, I heard many people say, the Upper House, the Revising Chamber, will do its job, and kick out the overly intrusive elements of the Bill. My colleagues in the Lib Dems there did their best, tabling amendment after amendment – but again, with no opposition from Her Majesty’s Opposition, it is almost impossible to make any progress on combating the excessive surveillance powers in the Bill. The deadline has now passed for any further amendments, and one looks in vain for any signs of the Labour party standing up for civil liberties.

There is a chance for Labour to back the Lib Dem amendments to the Bill – frankly, they could pick almost any of them to help redeem themselves. But all the indications are that they are utterly uninterested.

25 October is the crucial date. That will be the third reading of this legislation. If the House of Lords let it go through, then there is nothing more to do to stop this. There will be the quaint process of parliamentary ping-pong to tidy the last few words up, but from then on, the state will have powers to monitor your behaviours on and offline to a far greater extent than ever before.

The political divide of the future won’t just be left and right. It is also between a liberal, internationalist, open, tolerant view of the world, and a closed, nationalistic, authoritarian approach. We should all be very worried that both the government and the opposition have gone for the latter.