FOR a government allegedly keen on constraining the state and advocating greater transparency, the coalition has some big ideas about electronic surveillance—and an appetite for what critics are calling “secret justice” in court cases. On two fronts, it has become embroiled in clashes about the balance between liberty and security.

First, it plans in early May to set out proposed measures giving the authorities access in real time to more data on public communications, including not only mobile phones and e-mail—which they can track now with a bit of effort—but also Skype, Facebook and online games. Theresa May, the home secretary, said this week that extending surveillance was crucial to keeping the public safe against terrorists and criminals in a high-tech age.

At the same time, a rift has emerged between David Cameron, the Conservative prime minister, and Nick Clegg, his Liberal Democrat deputy, over how courts should deal with sensitive evidence in cases of suspected terrorism. Mr Clegg has broken ranks over a previously announced plan to extend the system of “closed material procedures” in which evidence is heard privately, without the defendant present. He opposes the idea that ministers, rather than judges, should decide whether civil proceedings are held in private, and objects to extending secret hearings to coroner's court cases. Mr Cameron's government has been coming under pressure from America over the amount of detail that can be revealed publicly in tricky proceedings. There are fears that intelligence-sharing could be restricted.

Attempts to extend the reach of the secret state caused headaches for the previous Labour government, which lost its battle for a longer detention period for terrorist suspects and failed in its attempt to introduce compulsory identity cards. Now the coalition, which promised a lighter touch on civil liberties, is in similar straits, especially over plans to curtail privacy on the internet.

The government insists it will not seek access to the content of communications, but says it can gain valuable intelligence by simply monitoring who is talking to whom, and where and when. Getting such traffic figures does not require a judicial warrant now, so the new plans are about modernising surveillance techniques, not expanding their scope.

Critics, such as Shami Chakrabarti of Liberty, a civil-rights group, disagree. Scanning the sites people access and identifying their contacts is akin to building up an intimate picture of them, she says; doing so faster and more thoroughly “increases the amount of surveillance without adding safeguards”. The Office of the Information Commissioner is equally unconvinced.

Practically, the idea also raises thorny questions. CCTV has been widely introduced in Britain over the past two decades to help prevent crime. Yet it often emerges when crimes occur that cameras were either not monitored or the images produced were not accurate enough to yield useful evidence. Whitehall sources say such flaws are less likely in proposed internet trawls, since the intelligence services focus on existing suspects, rather than random tracking of internet use. It does mean, however, that sophisticated offenders may take to using anonymous re-mailer and proxy servers based outside Britain, just driving the cat-and-mouse game to a deeper level.

Many countries are struggling to keep abreast of the security implications of new communication technology. In 2008 the Labour government proposed a similar extension of internet surveillance, only to be shouted down by, among others, Tories and Liberal Democrats. Americans discovered in 2005 that their spooks were hoovering up vast quantities of internet traffic and scanning it for anything suspicious, a practice that has continued despite doubts about its legality. In Germany the constitutional court ruled in February that the content of e-mails should be made available only in cases where lives or state property were in danger.

Politically, this territory is fraught for Mr Cameron: not only does it exacerbate coalition tensions with the Lib Dems; it also annoys many civil libertarians on his own side. Some compromise looks inevitable. The internet proposals, slated for inclusion in the Queen's Speech laying out the government's firm legislative agenda, have been downgraded to a mere draft for consultation. Mr Clegg is also insisting that he wants the government to row back on closed hearings. One way and another, extending the secret state does not look like a political winner.