A jealous ex Edinburgh police officer who kept tabs on his ex lover after they split has avoided jail.
Daniel Hamilton used police software to track colleague Lauren Boyle after she dumped him.
Hamilton - based in Edinburgh at the time - was later held by colleagues after the woman reported him to a boss.
It landed Hamilton in the dock at Glasgow Sheriff Court where he pled guilty to two charges of acting in a threatening and abusive manner.
Today, Sheriff John McCormick handed Hamilton a community payback order as an alternative to custody.
Hamilton must do 160 hours of unpaid work within a period of six months.
A hearing was told that the pair met in police college in 2017.
The first sign of bother was when Hamilton erupted at his then home in Glasgow's Kings Park area and punched his bedroom door.
At a couples' holiday last October, jealousy got the better of Hamilton and it was the last straw for Miss Boyle.
Prosecutor Alistair Shaw said: “ “He was caught by the woman looking through her mobile telephone.”
The pair split but kept in contact through text messages but Miss Boyle eventually blocked him.
Hamilton went on to use police software to follow Miss Boyle's whereabouts while she worked as an officer.
Mr Shaw added: “He completed a search for the woman and this revealed two incidents that she dealt with the previous day.
“Hamilton accessed and viewed both of these incidents when there was no obvious need to.”
The woman later met with her former husband at Taymouth Marina in Perth to discuss their divorce.
Mr Shaw said: “She knew Hamilton belonged to the car and became alarmed that he knew her whereabouts and had followed her.”
The court heard the woman then got emails from Hamilton to her work account.
This lead to her eventually alerting her supervisor.
Hamilton was later arrested by police at his home.
His lawyer Andrew Park told the court Hamilton has since resigned from the police.
Mr Park added: “He has applied for the army and the fire service and these positions are dependant on this case.
“He was blinded by his wish for the relationship to be resolved.
“He accepts the responsibility for his actions.”
Sheriff McCormick granted a six month non harassment order were Miss Boyle will not be contacted by Hamilton in any way.
He reduced Hamilton's sentence from 240 to 160 on account of his guilty plea.
Hamilton also lives in Edinburgh - but it is not known where in the city.