Media playback is unsupported on your device Media caption David Cameron: ''No one should be in any doubt, prisoners are not getting the vote under this government''

Britain will continue to defy a European Court ruling saying prisoners must be given the right to vote, Prime Minister David Cameron has said.

"No one should be under any doubt - prisoners are not getting the vote under this government," he told MPs.

This was despite a warning from the attorney general that Britain's reputation would be damaged if it did not respond to the ruling.

Dominic Grieve said the UK had a legal duty to implement the judgement.

However, he stressed there was "flexibility" in how the UK chose to respond, which wouldn't necessarily mean giving more prisoners the vote.

Most coalition MPs and Labour oppose giving prisoners the vote.

Mr Cameron said he was happy to offer MPs a further Commons debate to "help put the legal position beyond doubt".

The European Court of Human Rights (ECHR) has ruled that a blanket ban on voting for anyone sent to jail is illegal and the government has until the end of November to decide how to react.

The UK has been on a collision course with the ECHR since the Strasbourg court ruled in 2005 that it was a breach of human rights to deny prisoners a vote.

'Breach of obligations'

The court ruled it was up to individual countries to decide which prisoners should be denied the right to vote from jail, but said a total ban was illegal.

In May of this year, it gave the UK six months to outline how it proposed to change the law on prisoner votes.

Dominic Grieve told the Commons Justice Committee the UK had a legal duty to implement the judgements of international bodies it had joined.

If Parliament voted to keep a blanket ban on prisoners voting, the government would be liable to pay damages to those affected.

Mr Grieve said: "That would be costly to the United Kingdom, unless it chose not to pay... [which] would be a further breach of the obligations."

Analysis Votes for prisoners is a PR timebomb for the coalition, which is now facing a looming deadline to act, or receive an internationally embarrassing fine. Given that the UK has a reputation around the world for upholding the rule of law and human rights, refusing to comply with the court won't go down well with the legally-minded in government. If ministers kept to a 2010 proposal (rejected by MPs) a third of inmates would vote. Those 25,000 plus prisoners don't equal a parliamentary constituency - but campaigners say they are an unrepresented part of society who need to be taught citizenship. Critics accuse Labour ministers, who were so keen to tell everybody else to obey the law, of dragging their feet when Europe told them years ago that they had themselves broken it. In fairness, Labour did come up with proposals. It just never quite found the parliamentary time to go down in history as the government that allowed British criminals to vote.

He added: "The issue is whether the United Kingdom wishes to be in breach of its international obligations and what that does to the reputation of the United Kingdom."

It could, he said, be seen "as a move away from out strict adherence to human rights laws".

However, he stressed there was "a lot of flexibility" in the European ruling, and that Parliament had sovereignty over the issue of who was able to vote, as any change would require a Commons vote for amendments to the Representation of the People Act.

He told the MPs: "I think there are numerous ways in which government or Parliament could, if it wished to, approach the issue of change to the blanket ban.

"That approach need not necessarily be entirely in the direction of, 'We have got to give more convicted prisoners the vote.'"

'Over my dead body'

Mr Cameron's official spokesman denied the prime minister was in disagreement with Mr Grieve, saying: "There is a single government view on this issue, and that is that prisoners should not get the vote."

He added: "As the attorney general said earlier, Parliament is sovereign in these matters."

BBC political correspondent Robin Brant said one Tory backbench MP said any change would be made "over my dead body", and another that the justice secretary show the ECHR that "two can play at interminable delay".

For Labour, shadow justice secretary Sadiq Khan said: "The public will be rightly concerned at reports prisoners could get a vote. If true, thousands of those serving sentences for serious and violent crimes such as wounding, assault and domestic violence would be given a say in who runs the country."

But Liberal Democrat backbencher Stephen Williams, a member of the constitutional reform select committee, has said prisoners serving short sentences should be allowed to vote as part of their rehabilitation.

At present, the only prisoners allowed to vote in Britain are those on remand.