OAKLAND — A friend of a Berkeley woman fatally stabbed in an East Oakland apartment in 2012 testified Thursday that the last time he saw her alive, her accused killer was “tripping out” with a large kitchen knife in his hand.

“He was waving it around … so I left,” said Julius Johnson, 25, at the trial of Jamaal Prince, charged with the Dec. 28, 2012 murder of 26-year-old Jennifer “Jessica” Kingeter. “He scared me so I cut (out), I left.”

In the trial’s opening statements Wednesday, Prince’s attorney Al Thews told jurors that his client killed Kingeter in self-defense after she stabbed him in the leg. Kingeter had suffered dozens of stab wounds when she was found face down in the apartment bathroom with her clothes disheveled and her bra pulled down, according to trial testimony.

Johnson said he, Prince and Kingeter went to a Walnut Street apartment to hang out and drink alcohol and use cocaine. The apartment belonged to Prince’s child’s mother, according to testimony.

Johnson and Kingeter were sitting on the couch and talking when Prince started arguing and “tripping out” with the knife in his hand, Johnson said. He said he couldn’t remember what Prince was saying, but he felt he needed to get out of there immediately and didn’t realize until he was in the hallway of the apartment building that Kingeter had not followed him out.

“Were you scared for Jessica’s safety?” Thews asked.

“I was scared for everyone’s safety,” Johnson replied.

Johnson denied Prince’s claim that Johnson promised he could have sex with Kingeter that night if he bought the cocaine. There was no plan for sex, and he never attempted to prostitute his friend, Johnson said.

A woman who lived in a downstairs apartment testified Thursday that she heard what she thought was banging pipes, and a woman yelling, “Get off of me, get off of me, leave me alone,” followed by a man yelling, “I’m done, I’m done.”

Outside of the jury’s presence, Alameda County Judge Jon Rolefson said that Prince’s brother was detained outside the courtroom and his phone was confiscated for taking pictures of witnesses coming and leaving the courtroom.

Taking photos in the immediate vicinity of the courtroom is in violation of judicial order, and photographing witnesses could be construed as a witness intimidation tactic, Rolefson said.

The jury is expected to get the case against Prince sometime next week.