David Cameron has given a firm riposte to the European Court of Human Rights (ECHR), which has ruled that some prisoners in the UK should be allowed to vote.

Speaking in the Commons on Wednesday the Prime Minister rejected the court's ruling, saying parliament should have the final say.

He told MPs he backed their overwhelming vote last year that effectively opposed the European Court of Human Rights (ECHR) ruling.

"I have always believed when you are sent to prison you lose certain rights and one of those rights is the right to vote," he said.

"Crucially, I believe this should be a matter for Parliament to decide, not a foreign court.

His comments suggest Britain is once again on a collision course with the European Court on who decides British policy, at a time when the UK is leading attempts to get the ECHR reformed.

It also presents the possibility of a fresh split within the coalition government - since Nick Clegg is thought to favour the introduction of voting rights for some inmates.

The European Court ruled on Tuesday that while it was not illegal to ban some prisoners from voting, a total ban was unlawful - a move which could see thousands of prisoners getting the right to vote.

Last year the Commons voted on a motion to maintain the blanket ban, which has existed in England and Wales for nearly 150 years.

The European Court has given the UK six months to comply with European Law or face massive fines, but the government's position on prison votes has cross-party support and was backed earlier on Wednesday by shadow Chancellor Ed Balls.

The row with Europe began during the past Labour government and has continued to escalate since the general election. The wrangle began when UK inmates complained that the loss of voting rights violated a Human Rights Convention Article guaranteeing the "right to free elections".

The court twice decreed the UK's total ban on votes for prisoners to be illegal.

On Tuesday the ECHR accepted the UK government argument that "each State [in Europe] has a wide discretion as to how it regulates the ban, both as regards the types of offences that should result in the loss of the vote and as to whether disenfranchisement should be ordered by a judge in an individual case or should result from a general application of a law".

However, the judges added that Tuesday's decision amounted to confirmation of a ruling against the UK in 2005 that a blanket ban on all serving prisoners losing voting rights is a breach of their human rights.

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

Britain is currently using its presidency of the European Council to attempt reforms of the European Court, primarily to speed up the rejection of spurious cases which leads to foreign criminials languishing in jail during lenthy appeals processes.

However the government has admitted that getting agreement on reforms represents an enormous challenge, with some commentators believing a failure to get reform could pave the way for Britain taking unilateral action, possibly involving the creation of a UK Bill of Rights, strongly favoured by Home Secretary Theresa May.