Lizette Cauich doesn’t deny she fatally stabbed a 58-year-old flagger at a San Francisco construction site where she had tried to use a portable toilet. The blows in June 2016 were captured on video and played at her trial.

Cauich admits as well that she and her boyfriend badly wounded a parking lot attendant in another broad-daylight stabbing 12 days earlier — also after an attempt to use a bathroom. And she doesn’t deny being a methamphetamine user.

The 25-year-old’s explanation? Self-defense.

“I was scared,” Cauich testified Tuesday, taking the witness stand at her Superior Court trial on murder and assault charges to contend that the victim had pulled her hair.

Recounting the moments after she repeatedly stabbed flagger Mitzi Campbell and left the grandmother bleeding on a South of Market sidewalk, the slight and soft-spoken defendant said, “I didn’t know what to do. I was in shock.”

San Francisco prosecutors paint a different picture. They say the stabbings stemmed from Cauich’s anger over being turned away from the portable bathrooms — and that the victims did nothing to provoke her.

Her trip to the witness stand followed three weeks of evidence presented by the district attorney’s office that included surveillance video of the violence, eyewitness accounts and testimony from the victim who survived the earlier attack.

In response, defense attorneys said Cauich, who was homeless in San Francisco, suffered from post-traumatic stress disorder from being sexually and physically abused, leaving her constantly on guard and ready with a knife for any would-be attacker.

Cauich and her boyfriend, 44-year-old Oscar Mendez, were arrested shortly after Campbell’s killing on June 10, 2016. Almost immediately, they were identified as suspects in a May 29 attack at a parking lot at Eddy and Taylor streets in the Tenderloin.

ALSO News Push to recall Stanford rape case judge qualifies for ballot

Cauich is charged with murder, assault with a deadly weapon and battery in the two incidents. Mendez is charged with accessory after the fact in Campbell’s killing as well as assault with a deadly weapon and battery in the Tenderloin stabbing.

Campbell’s family members have seen every day of the trial, following along intently from the gallery of Judge Robert Foley’s courtroom. They described Campbell as beautiful, charming and loving, a big Warriors fan who was dedicated to her job.

Cauich and Mendez came to San Francisco in May 2016 after dating in Los Angeles, where Cauich grew up. The couple stayed at the Multi-Service Center-South homeless shelter at Fifth and Bryant streets, and often drank alcohol and used meth during the day, Cauich said.

The first stabbing happened days after their arrival. It was Memorial Day weekend, and the victim, Amar Dahmi, was manning a kiosk in a Tenderloin parking lot. Both Dahmi and Cauich testified that she approached him and asked to use the toilet.

Dahmi said he politely asked her to leave before she whipped out two knives and came at him, prompting him to use a garbage can to shield himself.

Cauich said it was Dahmi who, unprovoked, hit her with the trash can after she asked to use the toilet.

“He ignored me — and I was like, ‘Excuse me, excuse me, excuse me,’” she testified. “And he was like, ‘No, bitch.’ Then he started hitting me with the trash can.”

Both agreed that Cauich walked away after the encounter, only to return with Mendez and another man.

The group chased the attendant down and stabbed him in the torso, lower back and leg before he hobbled off toward the Tenderloin police station to seek help, Dahmi said. He was treated at a hospital for life-threatening injuries and faces a long recovery from his wounds.

Cauich admitted stabbing Dahmi in the leg, but under cross-examination by Assistant District Attorney Andrew Gans she said she did not remember key moments of the encounter.

“I was mad at him,” she said at one point.

The third alleged assailant has not been identified or arrested.

The second stabbing occurred after Cauich went to a construction site near a Shell gas station on Shipley Street, an alley off Fifth Street, to try to use a portable toilet. But a pair of construction workers kicked her off the site.

In video from a nearby convenience store, Cauich is seen rounding the corner with her bike and then returning a few minutes later with Campbell, whose job required her to stop traffic for work trucks.

The footage shows a struggle, and Cauich can be seen stabbing Campbell, who drops motionless. Two of the stab wounds were fatal, prosecutors said, including one to her upper chest.

Cauich said Campbell had pulled her hair before they were in the camera’s view and threatened to beat her up. No other witnesses backed that account.

“She called me a skinny bitch and said she was going to stab my neck,” Cauich said. “I assume she had a weapon.”

That’s when Cauich said she “flashed” and started stabbing Campbell.

Her attorney, Eric Quandt of the public defender’s office, said the reaction was a result of physical and sexual abuse — including hair-pulling — at the hands of her mother’s boyfriend in Los Angeles. Cauich was diagnosed with PTSD at age 15, Quandt told jurors, and armed herself with knives for protection while living on the streets.

Construction workers flooded to the scene after the stabbing, and footage shows Mendez arriving and trying to usher Cauich away. He later tried to hide a knife under a car’s wheel well as police found and arrested them both, prosecutors said.

“These violent attacks start for one reason and one reason only — out of anger and her temper,” Gans, the prosecutor, said earlier in the trial. “When she was told ‘no,’ she couldn’t take it.”

The trial resumes Wednesday.

Evan Sernoffsky is a San Francisco Chronicle staff writer. Email: esernoffsky@sfchronicle.com Twitter: @EvanSernoffsky