Ashley Benson Pervy Security Guard Must Stay Clear of 'Pretty Little Liars' Star

7/12/2014 12:20 AM PDT

"Pretty Little Liars" star Ashley Benson just got a measure of security from a judge  ... who ordered  a creepy security guard on what he called a sexual mission from God to stay clear of her.

49-year-old James Gorton Jr. -- who worked as a guard on the lot where PLL is filmed -- must stay 100 yards clear of her for 3 years.

We broke the story ... Gorton claimed he had sexual feelings for Benson and believed she was silently communicating with him ... saying God ordained him to be with her.

Gorton won't get closer to PLL than a TV set ... he's been fired from his security post.