A man accused of killing his girlfriend was shot to death in a Stockton courtroom Wednesday after he attacked the judge presiding over his murder trial, an official said.

David Paradiso was shot after he left the witness stand and began attacking San Joaquin County Superior Court Judge Cinda Fox during a break in proceedings, said Karen McConnell, a county spokeswoman.

McConnell said Paradiso had been testifying about 2 p.m. when his mother, in the audience, left the courtroom upset. Fox called a recess, and as jurors filed out, Paradiso left the stand and approached the judge from behind, she said.

McConnell said witnesses reported seeing Paradiso lift the judge and begin punching and possibly stabbing her when bailiffs ran to her aid and shots rang out. It was not immediately clear who shot Paradiso.

The Stockton Record, which was covering the trial, reported that the judge was carried out on a stretcher and had bandages on one arm but was conscious and alert.

The courthouse immediately went on lockdown, McConnell said.

Paradiso was on trial for allegedly stabbing his girlfriend in the neck in his mother's car in 2006.

His attorney, Charles Pacheco, did not immediately return a call seeking comment.