SANTA ROSA (CBS SF) – A Santa Rosa man was sentenced in Sonoma County Superior Court on Tuesday to nine years in prison for attempted sexual assault of a woman, battery on custodial officers and other charges.

Nicholas Planty, 43, a registered sex offender on parole, followed a 19-year-old woman home from the Coddingtown Mall on July 9, 2016. The woman ran to a neighbor’s apartment and was let inside, but Planty tried to force his way into the apartment, according to the Sonoma County District Attorney’s Office.

READ MORE: Santa Clara Shoe Store Ransacked in Late Night Smash-and-Grab Robbery

Police responded and found Planty on the neighbor’s front porch looking inside the apartment through a window. Planty told the officer the woman caught his eye and he wanted to ask her for a cigarette. During a search, a police officer found Planty had a full pack of cigarettes and a lighter, prosecutors said.

READ MORE: COVID Omicron: Rush To Vaccinate In East Bay As New Variant Emerges

While in jail waiting for his trial on attempted sexual assault and trespassing, Planty “gassed” custodial officers by throwing feces at them. He has prior convictions for lewd and lascivious conduct with a child, felony battery on a peace officer and felony gassing of a custodial officer, according to the district attorney’s office.

Planty pleaded no contest in June to charges of attempted sexual battery, attempted trespassing, peeping inside an inhabited dwelling and five felony counts of battery by gassing.

MORE NEWS: Lee Elder, 1st Black Golfer To Play Masters, Dies At Age 87

© Copyright 2019 CBS Broadcasting Inc. and Bay City News Service. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.