INDIO (CBSLA) — Actor Nicholas Brendon struck a plea deal with prosecutors Friday, staving off a possible four-year jail sentence.

In exchange for pleading guilty to attacking his girlfriend nearly three years ago at a Palm Springs hotel, Brendon — best known for the role of Xander Harris on television series “Buffy the Vampire Slayer” — will serve three years of probation and must complete a 52-week domestic violence course and 20 hours of community service.

Brendon’s original felony charge of inflicting corporal injury on a spouse was reduced to misdemeanor domestic battery.

The 48-year-old actor, who has spoken publicly about his battles with depression, alcoholism and substance abuse, was accused of grabbing and “violently” pulling his girlfriend by the hair at the bar inside the Saguaro Hotel in downtown Palm Springs on Oct. 11, 2017.

After Brendon entered his guilty plea, the victim recounted a relationship allegedly riddled with physical and emotional abuse.

“When somebody holds a knife to your throat, it changes you as a person, and it changes you forever” she said. “I can never erase the pictures in my mind of being strangled and thrown across the room, or being covered in bruises, bite marks and scratches, all because I tried to care for someone.”

Brendon is also barred from coming into contact with the victim for the next three years.

(© Copyright 2020 CBS Broadcasting Inc. All Rights Reserved. City News Service contributed to this report.)