A college electrician who secretly filmed a teenager in the bath and a family friend naked on a sun bed at his home with a hidden camera, yesterday narrowly avoided a custodial sentence.

Calum Blackadder, 38, who borrowed a video camera from Edinburgh's Queen Margaret's College where he worked and hid it in two rooms in his house to secretly film the women, was ordered to carry out 120 hours' community service.

Edinburgh Sheriff Court earlier heard how he had waited until his wife, Valerie, was on holiday abroad before hiding the camera under a towel on a shelf in a bedroom where a family friend used the sun bed.

He then positioned the camera through a small hole in the bathroom ceiling, normally for a shower cord, while redecorating work was going on. He filmed the 17-year-old then copied the film on to a videotape which he kept in a work locker.

A colleague borrowed the film four years later, thinking it was a movie, and immediately took it to the police.

Blackadder was earlier found guilty of two breach of the peace charges by secretly taping the women while they were naked in his then home in Featherhall Avenue, Edinburgh, in 1995.

Sheriff James Farrell told Blackadder he would have jailed him had he not been a first offender and described the crimes as ''sordid and premeditated''.

Before making the video, Blackadder, now of Glebe Grove, had secretly filmed a sex session with his wife without telling her.

He told the court he had put the camera in the attic to film himself in the bathroom doing a dance for his wife ''to show her what she was missing'' while in Tenerife. He had forgotten to turn it off before the teenager took her bath.

Mrs Blackadder, a child minder, has left her husband since the incident and in February this year he was dismissed from his job.