Chloë Grace Moretz has finally been granted a permanent restraining order against a man who has allegedly been stalking her for some time now.

On Friday, a judge granted the “If I Stay” actress’ request for a permanent restraining order against an alleged stalker. Initially, Moretz’s brother, Brandon, asked for a temporary restraining order against the 18-year-old harasser, according to The Blast.

Brandon’s request was granted early this month after the actress’ alleged stalker tried to trespass their family home a couple of times. The latest of which took place on June 30, when the “unknown trespasser” climbed over the gate of their private residence and “violently” banged on their doors and windows.

The harasser, whose name was not disclosed to the press, attempted to break into their house in hopes of gaining access to Brooklyn Beckham’s ex-girlfriend. The Moretz family quickly phoned police and the man was arrested.

Surprisingly, just a day after his attempt at breaking into the “Carrie” actress’ home, the person in question managed to once again repeat his trespassing stunt but failed. He was then taken by the cops for the second time.

During his first arrest, Moretz’s harasser was booked for misdemeanor trespassing. He got out of jail at 5:36 p.m. on the day of the arrest. He was rearrested at 8:45 p.m. on July 1 over stalking charges, as per TMZ.

This week, Brandon showed up in court to testify against his sister’s tormentor, and this helped secure a permanent order that would benefit the “Greta” star for the next three years. Apparently, the restraining order is set to expire on July 26, 2022.

Meanwhile, it seems Moretz wasn’t really affected by the trespassing incidents since she was photographed in London happily enjoying some retail therapy with a pal named Katie a week after they happened. For the outing, she sported a denim button-down and a pair of sunglasses.

After calling it quits with David and Victoria Beckham’s eldest son early last year, Moretz went on to date Playboy model Kate Harrison in December. Then this past March, the two of them were photographed holidaying in Mexico. It’s not clear if they are still together at present.

Chloe Grace Moretz
Pictured: Chloë Grace Moretz poses during the AwesomenessTV special fan screening of “The 5th Wave” at Pacific Theatre at The Grove Jan. 14, 2016 in Los Angeles. Getty Images/Kevork Djansezian