A 27-year-old Petaluma man pleaded guilty Wednesday to an attempted robbery near a Rohnert Park pedestrian trail when he hit a woman in the head with a wine bottle while trying to steal her purse, Sonoma County District Attorney officials said.

The woman fought off her attacker, later identified as Randy Solares. But apparently shortly after the Aug. 26 attack on the Copeland Creek Trail near the Santa Alicia footbridge, Solares confronted people on the street with a weapon and burglarized a car, officials said. He was arrested the next day when he showed up for an appointment with his probation officer, police said.

In an agreement with prosecutors, Solares pleaded guilty to attempted robbery with a weapon and felony possession of stolen property. He will be sentenced to four years, eight months in state prison in December, prosecutors said.

District Attorney Jill Ravitch said in a statement the attack was an “incredibly frightening incident for the victim.”

You can reach Staff Writer Julie Johnson at 707-521-5220 or julie.johnson@pressdemocrat.com. On Twitter @jjpressdem.