Kendall Jenner might finally get some peace of mind -- a judge has ordered the obsessed man writing her creepy love letters to stop and stay the hell away.

Kendall wasn't in court but her lawyer, Shawn Holley, was Wednesday morning in downtown L.A. and presented a declaration from Kendall's head of security. That document was enough for the judge to grant her a permanent restraining order against Thomas Hummel

He must stay at least 100 yards away and he's forbidden from trying to contact her in any way, shape or form for 3 years. Thomas also can't own any guns during that time.

TMZ broke the story ...  back in July, Kendall said she needed protection from Thomas because he was flooding her mailbox with love letters that later turned hostile -- he went from professing his love for her to calling her "an internet whore."

WE GOT WHAT WE WANTED
TMZ.com