Katy Perry has won a restraining order against an alleged stalker.

According to court documents obtained by The Blast, the pop star filed a petition for protection against a man named William, after he trespassed on her property and threatened her family.

The protection request extends to her fiance, Orlando Bloom, their baby daughter, Daisy Dove, and his nine-year-old son, Flynn.

"I do not know him. He is a complete stranger who trespassed on my property, is stalking me and who threatened my family," Katy wrote.

She lists the date of harassment as 8 September 2020 and revealed she was with her husband-to-be and their daughter when she encountered William, who "jumped the fence of my home in the Beverly Hills area".

Katy also claims her security staff ordered the man to leave and when he refused, he was "placed under citizen’s arrest and then formally arrested for criminal trespass" by the Los Angeles Police Department.

"William has made threats on Twitter including that he wants to 'snap Orlando Bloom’s neck', as well as lewd posts about me," Katy shared.

She added: "He has entered my property and poses a violent threat to all of us."

Worrying that the stranger may have access to firearms, Katy continued: "I am in immediate fear for my own safety, that of my partner, my newborn child, our family, and friends."

She was granted a temporary restraining order on Tuesday and a hearing has been set for 8 October.