A MAN caught cowering in a primary school toilet with a knife has been spared prison.

Hugh Sellar sneaked into St Ninian's in Gourock in a suspected late night attempted raid.

The 38-year-old was arrested after a witness spotted him and a pal crawling underneath a gate after 10pm.

Defence lawyer Erin Monaghan told Greenock Sheriff Court that her client's offence was 'so serious and so silly'.

Sellar's self-employment as a computer technician has been 'damaged' as a result of the incident, the court heard.

Miss Monaghan said: "It is Mr Sellar's position that he was in his car with his friend, who has a drug problem which Mr Sellar does not have.

"His friend wanted to stop and have a look about.

"Mr Sellar knew what his friend's intention was, but he did stop."

Procurator fiscal Ziad Ul Hassan said: "Police attended and located an insecure fire exit.

"They entered the school, conducted a search and traced the accused hiding in a bathroom.

"The accused was arrested and searched and a black-handled lock-back knife was recovered from his left pocket."

Sellar pleaded guilty to being within the Staffa Street school building without lawful authority so that it may be reasonably inferred he intended to commit theft, and to unlawful possession of the knife.

He committed the offences on August 15 last year.

A background report assessed him as being of low risk of reoffending.

Solicitor Miss Monaghan said: "Although he does have a record, this is the first instance of dishonesty."

Sheriff Andrew McIntyre — noting that the offence carries a maximum prison term of three months — ordered Sellar to complete 225 hours of unpaid work within nine months instead.

The sheriff told him: "This is a turn for the worse on your record at the the age of 38.

"You are on the cusp of a prison sentence, however, I am just persuaded that an alternative to prison is available."

Sellar, of Grieve Road, Greenock, will also be under supervision for the duration of his community payback order.