A detective who blackmailed a prostitute's customer found himself investigating his own crime, a court has heard.
Gareth Suffling, 35, photographed the customer, found his details using the Police National Computer and then left a note demanding £1,000 to keep quiet.
The crime was investigated by Suffling's own squad, Bedfordshire Police's Serious Organised Crime Unit.
He admitted blackmail and was sentenced earlier to 18 months in prison.
He also admitted misconduct in a public office.
'Perversion above family'
Suffling claimed he had wanted to help a vulnerable woman after seeing images of the Ipswich sex workers killed in 2006 in a police presentation, St Albans Crown Court heard.
The 35-year-old, of Barton-Le-Clay in Bedfordshire, visited an adult escort website and contacted the prostitute to see where she worked.
Having photographed the victim entering the prostitute's caravan in Luton for 15 minutes on 16 March, Suffling found his home and left a package containing photos and a letter.
Prosecutor Angus Robertson said the note demanded a payment of £1,000 and read: 'Do you really want the people closest to you to know about this? You put your perversion above your family".
The court heard Suffling was invited to play a part in surveillance at the money drop off point.
The incriminating clue
His colleagues noted he was acting "strange", looking at his phone and drinking water excessively.
His crime came to light when Suffling was identified as having made the Police National Computer inquiry on 17 March.
Suffling claimed the victim's car had been driven dangerously, but "suspicion fell on the defendant as dangerous driving inquiries would not normally be carried out by his unit", the prosecutor said.
Recorder Jeffrey Yearwood said he was "confident" he could dismiss the explanation Suffling, who had a history of financial problems, gave that it was "some altruistic act on his part".
Mr Yearwood said: "It was an ugly crime. As a police officer you would have been well aware of the gravity of offences involved."