Scotland’s judges have outlined their opposition to plans allowing them to decide on whether a prisoner should be given the vote.
MSPs are currently considering proposals which could enfranchise those serving custodial sentences.
But Lord Carloway said the judiciary was against suggestions that the decision could be made by trial judges in individual cases.
Scotland’s most senior judge said the matter was for parliament, not the courts.
Holyrood’s Equalities and Human Rights Committee took evidence on the issue earlier this year.
There is currently a blanket ban on prisoners voting, but this could be changed to allow all inmates, or those jailed for less serious offences, the right to vote.
In a letter to the committee, Lord Carloway said there was a consensus among the judiciary on the issue.
He said: “I understand that the committee wish to explore the possibility of the judge, or sheriff, in a particular case deciding whether a prisoner should lose his right to vote in particular elections and for what period.
“I have consulted the senior judiciary [the High Court judges]. All are opposed to such a course of action.
“There is a major problem of principle with the matter being determined by the court.
“The development of policy in this area is primarily a matter for parliament, which is best placed, after due democratic consultation, to decide where the boundaries should lie.”
The European Court of Human Rights has ruled against the UK’s blanket ban on giving convicted prisoners the vote on several occasions.
In 2014, the Supreme Court refused an attempt by two prisoners – Leslie Moohan and Andrew Gillon, both of whom are serving life sentences for murder – to vote in the independence referendum.
While the issue had previously been reserved to Westminster, new powers over the administration of elections north of the border means Holyrood is able to decide who votes in Scottish elections.
Christina McKelvie, convener of the Equalities and Human Rights Committee, has said the matter deserves “careful consideration”.
In his letter, Lord Carloway said it was “essential” for parliament to legislate on the issue.
He said: “Parliament could, for example, consider whether a person who is sentenced to a particular period of years in custody should lose his right to vote for that, or for an extended or shorter, period.
“Rather like the sex offender ‘register’ provisions, such a prohibition might operate automatically on sentencing and this would be clear to both the prisoner and the prison authorities. It is ultimately for parliament to determine such a fundamental matter of democratic principle.”