REDWOOD CITY -- A man who wore only underwear when he climbed into a woman's South San Francisco home and attacked her Saturday was released from jail just days prior for nearly the same crime, authorities said Tuesday.

In the most recent case, Rodney Rajiv Narayan, 25, of San Bruno was taken into custody Saturday after he appeared to perform a sexual act and battled with a woman in her home on the 800 block of Second Lane. It came several days after he was released from San Mateo County jail for a very similar attack in San Bruno on July 15, said San Mateo County Chief Deputy District Attorney Karen Guidotti.

In the San Bruno case Narayan allegedly broke a window and climbed into his downstairs neighbor's home. He was discovered moments later by a woman who got out of the shower and who allegedly found him holding her bra and shirt. He was again wearing only his underwear, Guidotti said.

Ten days after his arrest Narayan pleaded no contest to misdemeanor trespassing in San Mateo County Superior Court and was sentenced to 30 days in jail. With credit for time served and good behavior he would have been released on July 29 or 30, said Guidotti. The exact date wasn't immediately available.

Just says after his release, Narayan allegedly confronted the South San Francisco woman and her two children in their living room around 5:45 p.m. Saturday. He grabbed her arm and tried to "coerce" her into coming with him, South San Francisco police Sgt. Bruce McPhillips said.

When she refused he allegedly reached his hand into his underwear and appeared to engage in a sex act. At some point after that he walked into the garage and the woman locked the door behind him. She then called police.

McPhillips said officers found Narayan in a bedroom that's in the garage. He locked himself in the room and refused to come out, but police forced open the door and arrested him.

It appears the suspect got into the South San Francisco home by climbing through a garage window.

Narayan was booked into jail in Redwood City and pleaded not guilty Monday to residential burglary, indecent exposure and battery, Guidotti said. All are felonies.

Narayan was being held in lieu of $100,000 bail in Redwood City.

Contact Joshua Melvin at 650-348-4335. Follow him at Twitter.com/melvinreport.