The intruder, Che Cruz, has been ordered to seek treatment at a mental health facility for at least 30 days, reported TMZ.
Once this time period is up, Che must attend another 180 days at the facility but will not be forced to stay there.
The judge handed the 20-year-old a very unusual 10-year protective order requiring him to stay 200 yards away from Gomez, 21, at all times.
The cops were called to the singer's Los Angles home on April 4, after they were alerted that a suspicious looking man had jumped over her fence.
The 'Come & Get It' singer's friend, who answered the door, told Cruz that she wasn't and he left, but when authorities arrived at the house they found him hidden in Gomez's guest house, after allegedly breaking in.
