A Santa Rosa man who stabbed a man he'd just met a dozen times and threatened a girlfriend to dissuade her from reporting the violence settled his case in an agreement with prosecutors, Sonoma County District Attorney Jill Ravitch said Tuesday.

Glenn Arthur Bates III, 30, pleaded no contest to attempted murder, inflicting great bodily injury and dissuading a witness during a Thursday hearing.

Bates will be sentenced to 15 years in prison under the agreement at an Oct. 24 hearing before Judge Gary Medvigy. He must serve 85 percent of his sentence before being eligible for parole, Ravitch said.

Bates met the victim Nov. 2, 2012, at a gathering at a home outside Santa Rosa, according to the District Attorney.

The stabbing took place when Bates' girlfriend was giving the unidentified victim a ride home. In the car, Bates apparently began stabbing the victim around the head and upper body, Ravitch said.

The victim escaped and hid in a ditch off Mark West Springs Road until he crawled back onto the road at about 1:30 a.m. and was helped by a passing motorist.

Also in the agreement, Bates admitted to having a prior strike conviction for a residential burglary from 2001, Ravitch said.