Sofia Vergara just got some court-ordered protection for herself and her son from a man she claims has been relentlessly stalking ... despite the fact he was recently released from jail and on parole for committing the same crime in the past.
In legal docs obtained by TMZ, Sofia claims a man named Gregory Brown is a "mentally unstable stalker" with "a delusional belief he personally knows her and has a relationship with her and her family," including her 32-year-old son Manolo.
Vergara says his "aggressive and harassing conduct" has left her in fear for her safety and caused her anxiety and emotional distress.
She says, despite being jailed for trespassing and vandalism at her property earlier this year, Brown remains undeterred in his relentless pursuit of her.
Vergara claims Brown has made multiple efforts to gain access to her and her son ... including allegedly obtaining unauthorized access into the gated community by hiking from the hills in July 2023.
Most recently, in November, she says Brown mailed her a disturbing letter, writing, "he'll be seeing and hearing her very soon, my love," and signing off as "Gangsta."
Sofia says Brown has a rap sheet including arrests for various violent offenses, which make her more fearful about her safety ... and now the judge has signed off on a temporary restraining order requiring Brown to stay at least 100 yards away from her and her son and prohibiting him from contacting them.