A benefits cheat has avoided jail after a sheriff told him there was no room in Scotland's overcrowded prisons.

Sheriff Lindsay Foulis ordered George Munce to carry out 240 hours community service after he admitted fraudulently obtaining almost £10,000 in income support.

The sheriff's ruling emerged days after the chief executive of the Scottish Prison Service (SPS) spoke to The Herald about the dangerous level of inmates and called for a cap on numbers to help cope with overcrowding.

Mike Ewart said Scotland's prisons were in a state of "emergency" and were a risk to inmates, staff and the country.

Days later, Scotland's Chief Inspector of Prisons Dr Andrew McLellan said he backed Mr Ewart's concerns.

Munce, 46, from Auchterarder, Perthshire, had fraudulently claimed £9500 of benefits between April 2004 and July 2006 by maintaining he was single, despite having lived with his partner for almost a decade.

Sheriff Foulis told Munce: "We are told that prison populations are reaching crisis point and as a result - for a matter which I consider you well merit a custodial sentence - I am going to deal with it by way of the direct alternative."

Scottish Conservative Party justice spokesman Bill Aitken said the move was an "extremely dangerous development".

Mr Aitken said: "When a sheriff states that his sentencing options are being limited by prison capacity we have a real problem. If he feels jail was appropriate, that is the sentence which he should have imposed."

Scottish Liberal Democrat justice spokesman Robert Brown said judges should never be put in the position of having to decide a sentence on the basis of space in prisons.

He called on Justice Secretary Kenny MacAskill to take urgent steps to make clear to judges that it was not their job to worry about the number of criminals in prison, adding: "If they feel that sending someone to prison is the right outcome that is what they should do."

Labour's justice spokesman Richard Baker said: "This is a clear case of a sheriff not being able to give the proper sentence because of the crisis in the Scottish prison system."

MSPs at Holyrood were told on Wednesday that Scotland's prisons have more inmates than they can safely hold. Robert Black, the Auditor General for Scotland, said the safe limit was 8126 but they currently house about 8137.

Mr MacAskill yesterday said the Scottish Government would not comment on individual cases. However, he added: "It is for the sheriff to make a decision based on all the facts he has before him including the requirement to protect the public.

"The SPS has a statutory obligation to receive prisoners sentenced to a period of custody and that remains the case. As the sheriff states, this is a direct alternative to custody and is the maximum community sentence available."

Mr MacAskill stressed that no direction had been sent out to sheriffs.

Solicitor Cliff Culley, defending, told the court Munce was paying the cash back to the Department of Work and Pensions at £40 a month.