Scotland's most senior judges have hit out at government plans for a new body to draw up guidelines on sentencing.
Lord Justice General Lord Hamilton questioned the proposals, telling MSPs he had never seen evidence to suggest sentencing in courts was inconsistent.
His concerns were echoed by the Lord Justice Clerk, Lord Gill.
The Scottish Government has brought forward its proposals as part of the wide-ranging Criminal Justice and Licensing Bill.
The two judges told Holyrood's justice committee the plans were unconstitutional and would undermine judicial independence.
Under the Scottish Government's plans, the Sentencing Council would provide guidelines to which judges would have to adhere.
It would be chaired by the Lord Justice Clerk, but only a minority of its members would be judges.
Lord Hamilton said: "I think a situation in which an outside body which is not in itself an elected body and which comprises, as the present proposals indicate, of a majority of non-judicial office holders, does impinge upon the independence of the judiciary if it is going to lay down what are in effect prescriptive guidelines."
He went on: "Parliament is going to strip the High Court of Justiciary of powers it otherwise had and is going to pass on to a non elected, non judicial body the function which the High Court has exercised hitherto.
"That's where I find particular difficulty."
Lord Gill, who said the Sentencing Council should be restricted to a research and advisory body, added: "To read this you would think this was a Bill to appoint some other quango - but there is a huge constitutional question underlying this, and that's what troubles me."
Meanwhile, the Sheriffs' Association hit out at provisions in the bill to tell courts that jail terms of less than six months should not be imposed unless there is no other option.
Sheriff Michael Fletcher told the committee there could be problems if the courts had to rely heavily on community sentences - a policy championed by the Scottish Government - because some offenders ignored what they had been ordered to do.
"We require to have the ability to send someone to prison for a short sentence," Sheriff Fletcher said.
"It has worked wonders on some occasions, and you never see them again despite what the statistics tell you.
"That is the experience of any sheriff, I am assured."