A Hong Kong court banned “doxxing” police officers and their families in a bid to thwart pro-democracy protesters aiming to harass them, a report said.

The police force says many of its officers had personal information leaked online — aka “doxxing” — and their family members have been harassed, The Guardian reported.

The court’s temporary injunction, posted on government websites Friday night, has come under criticism for broadly shielding the identity of officers who clash with protesters.

Hong Kong has been embroiled in nearly five months of pro-democracy rallies with battles between police and protesters escalating in violence.

Lawyers for the police went to Hong Kong’s high court on Friday asking for an order forbidding people to publish the officers’ names, addresses, dates of birth and ID card numbers.

They also sought a ban on publishing an officer’s Facebook and Instagram usernames, license plates and any photograph of an officer or family member without consent.

The court granted the injunction for 14 days pending a full hearing.

The injunction also bans “intimidating, molesting, harassing, threatening, pestering or interfering” with any police officer or family member.

Superintendent Swalikh Mohammed of the Cyber Security and Technology Crime Bureau, who attended the hearing, told the South China Morning Post that the media would not be restricted under the injunction.

But the current wording makes no exceptions, leaving it unclear whether the order will restrict work by reporters.