Thomas Brodnicki, 46, is required to stay 100 yards away from the singer-actress until a Jan. 6 hearing.
Det. Jose Viramontes of the Los Angeles Police Department told Superior Court Judge William Stewart that Brodnicki is in a county hospital on a psychiatric hold and he could be there for at least 10 months.
Stewart said he won't grant a three-year restraining order while Brodnicki remains on a psychiatric hold unless he has assurances Brodnicki had an opportunity to be represented at a hearing.
One of Brodnicki's stalking charges was recently dropped after a judge determined that prosecutors hadn't proven he had caused fear in the "Wizards of Waverly Place" star.
The Associated Press contributed to this report.