A nurse stole prescription forms in order to get medication after becoming addicted to pain killers he had taken for a back injury, a court has heard.
Jordan Henderson, 38, of Dalbeattie, admitted the offence between March and July last year at Dumfries Infirmary.
He used the forms to get tramadol, diazepam and morphine sulphate which he had not been prescribed.
Henderson was given a community payback order to be under supervision for 12 months and do 150 hours unpaid work.
Dumfries Sheriff Court heard how the crime was uncovered when suspicions arose and hospital records were checked.
Solicitor Jacquie Latham said Henderson had been dedicated to his job and had never been in trouble before but had become addicted to painkillers he had taken for a back injury.
The court heard he had lost his job and background reports showed that there was no risk of him reoffending.
Sheriff Brian Mohan said that it was a breach of trust but Henderson had clearly expressed regret.