Media playback is unsupported on your device Media caption MPs announce their decision in the House of Commons

MPs have overwhelmingly voted to keep the ban on prisoners voting, in defiance of a ruling by the European Court of Human Rights.

The House of Commons' decision is not binding, but could put pressure on ministers to go against the Strasbourg court's decision.

MPs backed a motion opposing the move by a 234 to 22 - a majority of 212.

The government says it has to end the ban on inmates voting, or face being sued for tens of millions of pounds.

Senior Tory backbencher David Davis and former Labour Home Secretary Jack Straw tabled the motion, urging ministers to defy the ruling from the European Court of Human Rights that a blanket ban on prisoners voting was illegal.

'Thoughtful'

Mr Straw said: "I am delighted with both the fact and the scale of the vote, which underlines the strength of feeling in the House.

"It was a very sober and thoughtful debate. The motion was very carefully phrased so that it should strengthen the hand of the government in going back to Strasbourg saying we have now met one of the objections of the court that the House of Commons had not held a substantive debate on this issue."

Ministers say they have no choice but to comply with the ruling, but they will do the "minimum necessary" under European law, restricting the right to vote to inmates serving sentences of four years or less. They have until April to say how they will respond to the court ruling.

Analysis Could the government depart from the jurisdiction of the European Court of Human Rights? In other words, could it follow Parliament's will and ignore the court's judgement and its international obligations? Though the political consequences of allowing some prisoners the vote may be toxic domestically, the consequences of ignoring the court's judgement could be even more unpalatable internationally. Parliament can freely debate the issue of prisoner votes, but it is the government which has signed up to the European Convention on Human Rights. Ignoring the judgement could trigger compensation claims by UK prisoners. If the government paid up, it would be turning on a tap that would never stop running. That would cause a public outcry and is politically unthinkable. If the government overtly refused to pay the compensation, that would be unusual and the Council of Europe would have to consider suspending the UK. A suspension would place the UK alongside Belarus as the only major European state outside the council. Legislation of some sort seems inevitable and the government will do the minimum it can to meet its legal obligations. It is also likely to seek to address - through the Council of Europe's inter-governmental decision making body, the Committee of Ministers - disquiet about the role, judicial quality and running of the European Court of Human Rights, voiced by among others, the retired law lord Lord Hoffman.

During the debate, Mr Davis said he did not believe enfranchising prisoners would "stop one crime in this country" and he said he would not be satisfied with a compromise allowing those serving terms of less than a year to be given the vote.

This, he said, would permit thousands of people who had committed serious crimes to vote - something he said the public would "recoil from".

David Cameron said he did not see why the UK should have to change its policy, adding: "But I'm the prime minister. We're in a situation where the courts are telling us we are going to be fined unless we change this.

"I find it thoroughly unsatisfactory. In my view, prisoners should not get the vote, and that's that. But we are going to have to sort this out one way or the other."

Government ministers and Labour shadow cabinet members were ordered to abstain in the Commons vote, which is not binding on the government. Backbench MPs were given a free vote.

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

In 2005, the European Court of Human Rights ruled that blanket ban unlawful, and in June, the Council of Europe, which enforces the court's decrees, urged the coalition to rectify the situation.

For the government, Attorney General Dominic Grieve said he was "frustrated" by the current situation, but the judgement was an "international obligation" since the UK had been a signatory to the European Convention on Human Rights.

"How can we find a way in which we may be able to persuade the court to respect the views of the legislature... without ending up, for example, with having to withdraw from the Convention... which, I have to say, would not come without cost or consequence for this country?"

But a number of MPs, including Labour's Jeremy Corbyn and Lib Dem MP Tom Brake, warned that the UK could not "pick and choose" which parts of the European Convention of Human Rights it subscribed to.

Mr Brake said a ban on prisoners voting was "illogical" and the right to vote should be seen as part of the process of rehabilitation.

"Release from prison is not the point at which prisoners should re-engage with society," he said. "I do not want to shut the door on prisoners ready and willing to re-engage with society and sign up to the tenets that underpin it.

"As anyone who has visited a prison will know, there are some prisoners seeking that engagement."

The voting rights of prisoners is a UK-wide issue and will affect Scotland and Northern Ireland, even though the administration of justice is devolved.