A 20-year-old Dundee man was filmed by his shocked neighbours as he carried out a sex act in his garden.
Jack Duff was spotted throwing off his dressing gown before carrying out the act in clear view of neighbouring properties.
Duff was placed under supervision for 18 months on Thursday and ordered to attend the Tay Project to rehabilitate sex offenders.
His details were not added to the sex offenders register.
Duff was recorded after neighbours spotted what he was doing and the incident was reported to the police.
Dundee Sheriff Court heard he carried out a similar act in the garden after stripping off a second time more than a year later.
The court was told Duff admitted carrying out acts of public indecency in Midmill Road, Dundee, on March 21 2018 and August 22 2019.
Fiscal depute Christine Allan told the court: “The witnesses were all neighbours of the accused. At 4pm on March 21 2018 they were within their house when they observed the accused leaving the house with a housecoat on.
“He removed it and was naked. Due to his strange behaviour they recorded him on their phone. The accused seemed unaware anyone was watching.”
She said he carried out the act “for a short period of time before putting his housecoat on and running into the house”.
She continued: “On August 22 2019 another witness observed the accused again in Midmill Road. She saw the accused leaving his property.
“He was fully clothed and looking at a young female in the garden of a neighbouring property. He had his hand down his trousers. He again carried out a solo sex act.
“The witness was upset and almost crying. They observed him fully naked in his back garden.”
Solicitor Iain Houston said: “It is clear from the witness on the second occasion that he appeared to be unaware he was being observed.
“This was not a situation where he was deliberately doing it in front of everybody.”