The Scottish Executive is facing a £7m compensation bill for prisoners who will be denied the right to vote at the Holyrood elections in May after a landmark court ruling yesterday.

Giving Scotland's 7000 prison inmates £1000 each could be the only way to prevent the elections becoming entangled in potentially damaging legal actions.

In a ruling that decided Scottish prisoners must no longer be denied the vote, the Court of Session said the election would be "incompatible" with the European Convention on Human Rights (ECHR) because the UK currently operates a blanket ban on prisoners voting.

At least one law firm acting for prisoners now intends to seek an interim interdict against Scottish ministers to halt the elections. If they fail, lawyers intend to seek compensation instead. Council elections due on May 3 could also be affected.

With a recent court ruling from Europe that £1000 was appropriate compensation, the damages bill to the Scottish Executive could be up to £7m.

The unprecedented situation is likely to strain political relations between Edinburgh and London.

Although Scottish ministers could suffer the fall-out from the ruling, they are powerless to do anything about it as only Westminster can change to law to give prisoners the vote.

The Court of Session judges made it clear UK ministers knew there was a problem that needed fixed as early as October 2005 but repeatedly failed to act.

It was not until last month that the Department of Constitutional Affairs began a consultation on giving some classes of prisoners the vote, but this will not finish until March 7, leav- ing it too late to amend the law before the elections north of the border.

Lords Abernethy, Nimmo Smith and Emslie said Westminster's action plan for reform - which did not even refer to the 2007 Scottish elections - had "slipped, and slipped badly".

Solicitor Tony Kelly, who has already won compensation for prisoners forced to slop out, said he now intended to seek an interim interdict on behalf of multiple clients to stop "Scottish ministers from doing anything related to these elections".

He said: "There is a possibility of restraining the elections taking place. But if they do go ahead we will be seeking damages."

The Scotland Office said it did not believe prisoners had any grounds to challenge Scottish ministers, as UK ministers had responsibility for the elections.

Mr Kelly said he was "realistic" about the difficulties in stopping the election, but insisted Scottish ministers were vulnerable to legal challenge.