Any judge who takes on the government in the court of public opinion is bound to end up second best.

That was the lesson that the president of the Supreme Court learned the hard way last week. Sadly, Lord Phillips does not have a public relations adviser to remind him how effectively Michael Howard fought off criticism from Lord Taylor, the last senior judge to have a go at a Conservative government, in 1995/96.

This latest trial of strength began with an unexpectedly forthright speech from the UK’s senior judge on 8 February. Phillips had agreed to launch a three-year research project by the UCL Constitution Unit into the politics of judicial independence.

I must declare an interest as a member of the project’s advisory committee. We now have no shortage of material.

Explaining how the Supreme Court was meant to be funded, Phillips recalled a promise by the Labour government that the lord chancellor would simply act as a conduit through whom the court would seek funds from parliament, to be paid by the Treasury direct from the Consolidated Fund.

‘This ring-fences the Supreme Court budget and ensures that it cannot be touched by ministers,’ Lord Falconer, the lord chancellor, assured parliament in 2004.

Falconer’s promise proved worthless. To pay its wages, the Supreme Court of the United Kingdom is now dependent on whatever it can wring out of a government department responsible only for England and Wales. This is an obvious threat to judicial independence.

As Phillips pointed out, ‘it is already leading to a tendency on the part of the Ministry of Justice to try to gain the Supreme Court as an outlying part of its empire’.

The government hit back swiftly. Ken Clarke popped up on the BBC the following morning to insist that the court was in the same position as any other body for which he was responsible and could not set its own budget.

An ill-briefed presenter failed to remind the justice secretary that the power to set its own budget, subject only to parliamentary approval, was precisely what the previous government had promised the court when it was being set up.

But that clearly wasn’t enough for the Home Office. You can imagine it doing a Google search on Phillips, looking for a stick to beat him with.

What it found was a ruling he had delivered some 10 months earlier, on 21 April 2010.

The courts had been asked to consider the lifelong duty imposed by section 82 of the Sexual Offences Act 2003, on people sentenced to 30 months’ imprisonment or more for sexual offences, to keep the police notified of where they are living and any trips they might make abroad.

These notification requirements are referred to as ‘being on the sex offenders’ register’.

What Lord Phillips had declared – with the support of every other judge who considered the case – was that the lack of any right to have the continuing need for these requirements reviewed was disproportionate and therefore incompatible with respect for a released prisoner’s private life.

Non-lawyers may wonder how it is that the notification requirements remain in force nearly a year after they were declared incompatible with article 8 of the human rights convention.

The answer, of course, is that a declaration of incompatibility under section 4 of the Human Rights Act 1998 does not alter the law and does not require the government to seek a change in the law.

It certainly puts moral and political pressure on the government of the day. When the bill that became the Human Rights Act was first published, the government said that a declaration of incompatibility would ‘almost certainly prompt the government and parliament to change the law’.

But that is as far as it goes.

How then are we to explain the announcement on 16 February that the government was, after all, reforming the law?

It started with a story in The Times – briefed, presumably, by one of the home secretary’s special advisers.

Within hours, a government source had told the BBC, misleadingly, ‘we have no choice but to implement the Supreme Court judgment. There is no right of appeal.’

But as Theresa May was told later that day by her predecessor Jack Straw, ‘it would be entirely lawful... to say that the existing scheme will continue without any amendment’.

That was not the message that ministers wanted to hear. David Cameron had just said he was ‘appalled’ by the ruling that Phillips had given 10 months earlier.

The prime minister promised, again misleadingly, to take the ‘minimum possible approach to this ruling’. His phrase echoed the response on 11 January to the Hirst judgment on prisoners’ voting rights, which ministers said would be ‘the minimum necessary to comply with our obligations’.

But although the government is required by treaty to abide by the Strasbourg ruling on votes for prisoners, it does not have to amend the sex offenders’ legislation until the human rights court requires it to do so – as Strasbourg undoubtedly will unless the government takes action in the meantime.

Eliding the two requirements is dangerous.

On this page four weeks ago, I was sceptical about the prime minister’s claim last November that denying prisoners the vote would cost the government £160m.

Last Friday, the High Court found that there were ‘no reasonable grounds in domestic law for bringing a claim for damages... for being disenfranchised whilst a prisoner’.

The trouble with the law is that it’s never quite what the government wants it to be.