A police officer’s boyfriend has avoided jail after leaking personal data from case files on Twitter, including details of a vulnerable adult’s health and sex life.

William Godfrey admitted breaking data protection laws when he posted information he acquired from Surrey Police records.

He was handed a 12-month conditional discharge and ordered to pay £150 in costs and a £15 victim surcharge when he appeared at Maidstone Crown Court on Wednesday, the Information Commissioner’s Office (ICO) said.

The 30-year-old, of Bull Lane, Bethersden, had been in a relationship with an officer who was due to be dismissed before her probation ended.

He got hold of a USB stick full of data which should have been redacted or anonymised, the force said.

In July 2016 he tweeted the name, address, and personal details about the health and sex life of a vulnerable adult to the accounts of the ICO, the Independent Police Complaints Commission and the force.

On the same day he emailed the ICO threatening to publish a 40-page document containing personal data, which included the details of a victim of a sexual offence, and got involved in a Twitter conversation with another account holder who warned him he was breaking the law.

It later emerged another account also used by Godfrey tweeted the force two days earlier, disclosing the details of an individual who had been searched by officers.

The ICO asked him not to publish the material but he failed to hand over the USB stick despite numerous requests. Police had to take out a High Court injunction to retrieve it.

When he ignored the ruling, he was handed a suspended eight-week sentence and eventually returned the data, signing an affidavit to confirm this was the only record of the information in his possession.

The force pledged to improve its procedures after recommendations from the ICO.

A police spokeswoman added: “We have apologised to all the victims of the data breach for the disclosure of their information. The recommendations were promptly implemented as soon as we became aware of the breach.”

Steve Eckersley, head of enforcement at the ICO, said: “People should always be careful about what they share on social media, both about themselves and others.

“But when it’s sensitive and confidential personal information that they have no right to see or possess in the first place, then we will not hesitate to take action to protect people’s rights.”