John Mayer has obtained a temporary restraining order against an obsessed fan.

The Gravity singer claimed in court documents that Ryan Jeremy Knight, 39, began harassing and stalking him in March but the situation escalated when he also used social media to make violent threats against his team.

According to court documents obtained by E! News, Knight referenced notorious murderers including Ted Bundy and John Lennon's killer Mark David Chapman, and allegedly told John: "I've put many a jew in the hospital."

Other messages he was sent to have sent read, "You step from me again and I will kill you", "All ya had to do was be my pal", "I'm everywhere like god", and "PS watch your back".

Advertisement

On June 28, Knight turned up to a concert the 41-year-old singer was performing in North Carolina but was discovered by security and escorted out of the building.

In his filing, Mayer admitted the situation has caused him to "suffer substantial emotional distress".

A judge ordered Knight - who has a substantial criminal record - to stay at least 100 feet away from the singer and his home.

A court hearing has been scheduled for 27 August to determine whether the order should be made permanent.

Meanwhile, Tiffany Haddish recently revealed she has turned to the New Light singer for dating advice.

She said: "I've been talking with a lot of people, you know.

"I've been getting relationship advice since the last time I was here. John Mayer has been giving me relationship advice.

And asked what the specific advice was from John, she shared: "He said if there's somebody that I like that's in the eye of the public, I should ... when I'm doing interviews, say that I'm seeing that person.

Advertisement

"And then the media will do a side-by-side of us and then the guy will see and then he'll be like, 'Oh, she's kinda cute. I mean, I'm not hooking up with her but I could hook up with her.'"