The midnight ordeal of a retired sheriff at the hands of three robbers was described in court yesterday.

Ewen Stewart was repeatedly slashed, punched, and kicked on the head and body before being bound and gagged and a pillowcase placed over his head.

All the time, the intruders were demanding to be told where his money was, Inverness High Court was told.

All three yesterday pleaded not guilty and were due to stand trial before Lord Johnston and a jury.

However, after an adjournment and before any evidence was led, all three changed their plea to guilty to assault with intent to rob.

Geoffrey Williamson, 24, formerly of Wick, but now of Hatton Place, Rattray, Blairgowrie, admitted slashing, kicking, and punching the sheriff to his severe injury, as well as tying him up and gagging him. He was jailed for five years.

Raymond Rosie, 24, of Kennedy Terrace, Wick, admitted using a knife on their victim, assaulting him to his severe injury, and helping to bind and gag him. He was jailed for four years.

Rosie also admitted that, the previous night, while acting with other people he entered Sheriff Stewart's house and stole five plates, two napkin rings, and four spoons. He was jailed for a year on that charge, the sentence to run concurrently with his other jail term.

Hugh McPhee, 31, of Ackergill Crescent, Wick, admitted cutting the sheriff's phone wire before assaulting him by demanding money and tying him up and gagging him. Sentence was deferred for reports until August 14 in Edinburgh.

The court was told that all three had previous convictions for assault and theft, mostly at Wick Sheriff Court, where Sheriff Stewart presided until 1992, when he was sacked after his handling of cases was questioned.

Sheriff Stewart, who had lived alone since the death of his wife Norma in 1992, died from natural causes eight months after the raid on his home at Bignold Court, Wick, said Drew McKenzie, advocate-depute, prosecuting.

Mr McKenzie described what happened on the night of February 9 last year when the 74-year-old sheriff was disturbed from his bed and confronted the three accused and another man on the landing.

He said: ''While he was being slashed and beaten, it would appear that so frightened was Sheriff Stewart that he lost control of his bladder and bowels.

''The three accused ransacked the upper floor of the house, in particular Sheriff Stewart's bedroom and parts of his study, but, it would appear, left empty handed.

''They did, however, leave him bound, gagged and bleeding among his faeces and urine, where he lay for some seven hours until he was discovered in the morning by the paper boy.''

Lord Johnston told all three: ''The crime of assault and robbery is bad enough but this vicious attack was committed not only on an elderly person but in the home of an elderly person.''

Mr McKenzie said that after the theft from the house, the three accused decided to return to see what else could be stolen. They entered the unlocked house but on this occasion the sheriff was wakened by the noise.

He said: ''On the first-floor landing, he was beaten, bound, and gagged, and slashed with a knife. A bandage was tied around his mouth and a pillow case put over his head and his legs and arms bound with curtain tie-backs.''

He said Sheriff Stewart had been found hypothermic, with very low blood pressure, and spent six days in hospital being treated for four slash wounds to his face and one to his right arm which needed a total of 18 stitches, as well as bruises and abrasions.

The three accused came under suspicion when the stolen goods were found in the garden where Rosie lived.

Derrick Nelson, defence advocate, said Williamson had committed the offence under the influence of drink and Temazepam he was taking for depression but had never committed any crime of this magnitude before.

He added: ''He accepts fully it was a particularly nasty offence.''

Mhairi Richards, Rosie's advocate, said her client had not gone armed with a knife and it had been handed to him by one of the co-accused.