Two prisoners serving life sentences in Scotland have lost their fight to overturn the rules that bar them from taking part in the referendum in September - but the ruling of the Supreme Court should not be the end of the argument about whether inmates should have the right to vote.

It is too important a subject for that.

Traditionally, views on the subject divide along party lines, with the Liberal Democrats and the Greens supportive of the right of prisoners to vote in some cases and the Tories against. Prime Minister David Cameron has made it clear he believes convicted prisoners should lose certain rights, one of them being the right to vote.

The Scottish Government has also stated its support for the principle that convicted prisoners should not be able to vote while in jail and that the principle should apply to the referendum.

But what Leslie Moohan and Andrew Gillon, the prisoners involved in the recent case, have been arguing in court is that a prohibition on prisoners voting is incompatible with the European Convention On Human Rights and a breach of the common-law right to vote.

They have lost that argument in the highest court in the land, but some reform of prisoners' right should be considered. The general principle that a term in prison involves the withdrawal of certain rights, including the right to vote, is sound but whether that should apply to all cases is less certain.

The argument put by Patrick Harvie, co-convener of the Green Party in Scotland, is that extending the franchise to prisoners serving short sentences or those with only a short time left to serve would be a positive step on the basis that participating in the democratic process could help reform and rehabilitate those convicted of an offence.

The Scottish LibDems also support reform along similar lines. Leader Willie Rennie has said prisoners serving a sentence of less than four years should retain the right to vote.

There is a basis for good reform in what the Greens and the LibDems have to say, although caution is needed on the matter of those with only a short time left to serve being given the right to vote. In such a case, a prisoner might have been in jail for a very serious offence, including murder.

But the idea of the right to vote being given to prisoners serving shorter sentences does have the potential to win public support.

The penal system should also focus on rehabilitation but there has been an inexorable rise in prisoner numbers in recent years.

Non-custodial sentences for minor offences are a useful alternative and, when someone is sent to prison for a relatively short time, the authorities should do as much as possible to ensure such prisoners do not end up in a revolving door out of prison and back into it.

Ensuring prisoners become engaged, or have the wherewithal to be engaged, with society through having the right to vote could be a positive step in the direction of rehabilitation, in appropriate cases.