A man was “absolutely caught red-handed” during a housebreaking, Jedburgh Sheriff Court heard.
Neighbours phoned the police when they realised there were intruders in Shane Adamson’s home in Hawick’s Silverbuthall Road on December 12.
Officers turned up to find Robert Mason, 26, leaving the property with hairclippers, a torch, various items of food and some coins with a total value of £34.
His co-accused Craig Robson has already been jailed for 226 days for his part in the raid as he was caught in possession of £300 worth of items.
Procurator fiscal Graham Fraser told Jedburgh Sheriff Court: “Neighbours saw the two in the flat rummaging about and realised it was not the householders.
“The police attended rapidly, and the pair were caught coming out of the close.
“They were absolutely caught red-handed.”
Sheriff Peter Paterson told Mason, of Ramsay Road, Hawick, that the offence merited a custodial sentence, but he took into account the fact that he had managed to stay out of trouble for almost a year.
Mason was ordered to carry out 200 hours of unpaid work over the next eight months and was given a restriction-of-liberty order keeping him in his home between the hours of 7pm and 7am.