Mohammad Khaliqi, 31, was arraigned on one felony count of assault with the intent to commit rape, one felony count of assault to commit rape and two felony counts of false imprisonment.
He appeared in court before Judge Diane Northway and did not enter a plea.
While Khaliqi remains in custody without bail, Northway issued two protective orders, which is standard in sexual assault cases, according to Deputy District Attorney Bret Wasley.
"In case bail is eventually set in a case like this, these protective orders prevent him from having any contact, directly or indirectly, coming within 100 yards of either of these two victims," Wasley said outside court Tuesday.
On April 2, Khaliqi allegedly entered Mitsuwa Marketplace, a Japanese grocery store at 675 Saratoga Ave., and followed a 28-year-old woman into a public restroom where he allegedly attempted to sexually assault her, police said.
He fled before officers arrived, police said.
On May 5, Khaliqi allegedly followed a 13-year-old girl, who was walking home from school, and forced his way into her home in the 4000 block of Rio Vista Avenue, according to police.
The girl was able to fight him off and he fled the scene, police said.
"These are the actions of a brazen predator and it's a terrifying case," Wasley said.
Police released to the public last week photos and video footage captured in both incidents of the suspect.
A person who Khaliqi was renting a room from saw the video, recognized Khaliqi and alerted police, Wasley said.
Investigators were able to locate Khaliqi in San Leandro and arrested him without incident, police said.
In court, Khaliqi was assigned an attorney with the Public Defender's Office and is scheduled for a plea hearing on May 19.