Updated

A homeless man has been ordered to undergo psychological treatment after pleading no contest to stalking Selena Gomez.

Los Angeles County prosecutors say Che Thomas Cruz entered the plea Friday and was told to spend six months in a residential treatment facility followed by a year of psychological treatment.

He'll also have to stay 200 yards away from the singer-actress and her home for 10 years.

Authorities say Cruz went to the home of Gomez twice and was arrested in March for breaking into her guesthouse in suburban Calabasas.

He pleaded no contest in April to a misdemeanor trespassing charge.

Cruz spent two days in jail but hours after his release he jumped a fence at Gomez's home and was rearrested.