Labour will back David Cameron if he chooses to fight an ultimatum issued by human rights judges giving Britain six months to change the law on prisoners' voting rights, shadow chancellor Ed Balls has said.

Mr Balls said there was cross-party agreement about not giving the vote to prisoners and the ruling by the European Court of Human Rights (ECHR) was the "wrong thing".

"This is one of those times in politics where there is cross-party consensus," he told ITV Daybreak.

"The court first said this in 2004, that prisoners should be able to vote, and Labour then said we disagree and we did not implement it. I am all in favour of prisoners having the right kind of support and being rehabilitated but voting is one of the things I think you give up if you go to prison. So we all agree that this is the wrong thing."

He added: "If David Cameron is going to go out there and fight this one, we will be supporting him on that."

Mr Balls was speaking after the ECHR gave Mr Cameron six months to change the law in Britain on prisoners' voting rights. The court acknowledged that it was up to national authorities to decide exactly who can vote from jail - but denying the right to all inmates indiscriminately is illegal.

The ultimatum was issued as the Strasbourg court ruled in a separate case that depriving an Italian convicted murderer of voting rights did not breach his human rights. But the judges emphasised that this was because in Italy, unlike the UK, there is no "general, automatic, indiscriminate" ban in place.

The ruling pointed out that in Italy the loss of voting rights applied only to prisoners guilty of certain types of offences and where a sentence of at least three years is imposed. For those affected, the right to vote can be restored three years after the sentence has been completed.

The judges effectively challenged the UK Government to agree within six months on what parameters to set for British prisoners, and to scrap the total ban.

The judges said that if the UK complies with the order to grant some prisoners voting rights within six months, the court will strike out all similar pending cases from UK prisoners - about 2,500. That would remove the threat of massive potential Government damages payments to prison inmates if all complaints went through the Strasbourg court and were upheld.