MARTINEZ — A 29-year-old man pleaded no contest to stalking a video game streamer as part of a plea deal with county prosecutors, according to the Contra Costa District Attorney’s office.

Nizar Nassar, of El Sobrante, pleaded no contest to one count of felony stalking and one count of misdemeanor stalking. He was sentenced to 120 days in jail, with three years probation. He was also ordered to undergo a mental health assessment and drug treatment, along with anger management classes.

According to authorities, Nassar sent a message threatening to kill the woman in addition to several profanity-laced messages in which he wished all sorts of harm to befall her. According to court records, the victim is a Canadian woman who has a popular account on Twitch, a video site used primarily by video gamers.

The messages contained insults, threats and a sexist rant where Nassar allegedly asked the woman, “If female streamers are the same as male streamers and your success isn’t based primarily on your appearance rather than your gaming skills, then how come on days when your (sic) feeling unattractive do you stream with your webcam off?”

The tipping point came in November, when the woman — who this newspaper is not naming — said on Twitter she was staying at a Toronto hotel with her boyfriend. According to police, Nassar called the hotel, had a brief talk with the boyfriend, then sent a message to the woman saying he would kill her.

When officers showed up to arrest him last December, he reportedly resisted and told police to shoot him. An officer stunned him with a stun gun and took him into custody.

The probation terms require all of his online activity to be monitored and allow authorities to search his electronic devices without a warrant, prosecutors said.

Attorneys for eight drug distributors, pharmacies and retailers facing trial next month for their roles in the opioid crisis want to disqualify the federal judge overseeing their cases, saying he has shown bias in his effort to obtain a multibillion-dollar global settlement.