A 44-year-old man charged with stabbing a Long Beach police officer repeatedly lashed out at a judge and his own attorney during a preliminary court hearing on Wednesday as he tried to dispute the evidence being presented against him.

Arturo Scott Fernandez called the judge a “biased pig,” claimed a video of him fighting with officers had been edited and sought to have his public defender kicked off the case. But the hearing went on, and Judge Manual Almada ultimately ruled there was enough evidence to hold Arturo Scott Fernandez on $2.29 million bail until he can face a full trial.

He’s charged with attempted murder, two counts of assault with a deadly weapon on a peace officer and two counts of resisting an executive officer for the attack outside the Long Beach Grand Prix on the afternoon of April 17.

Prosecutors said the situation began when a 911 caller reported seeing a group of three young men arguing with an older man outside the Billie Jean King library. In the background of the 911 call, a dispatcher heard the phrase “put that away,” apparently referring to a weapon one of the men had.

When officers arrived, Fernandez was walking away holding a bag across his chest, LBPD homicide detective Juan Carlos Reyes testified. They ordered Fernandez to drop the bag, but when he refused and began walking toward a group of bystanders, the two officers rushed in to try and arrest him, Reyes said.

Security camera footage played in court showed Officer Daniel Velasquez grappling with Fernandez as he made stabbing motions down toward the officer’s head and back.

Eventually, the officer grabbed hold of Fernandez’s arm and his partner, Officer Ivone Sanchez, rushed in to wrestle Fernandez.

After about 15 seconds of the two struggling to get Fernandez into handcuffs, two Federal Air Marshals rushed in and helped get Fernandez to the ground.

Geoff Lewin, the prosecutor on the case, said the marshals were in the area as extra security for the Grand Prix, which drew roughly 200,000 attendees to downtown over three days in mid-April.

Officer Velasquez suffered stab wounds to the top of his head and upper back, Reyes testified, adding that the officer only realized he had been stabbed after the altercation was over, when he allegedly saw the knife in Fernandez’s hand. He was treated at a hospital and quickly released.

Fernandez interrupted Wednesday’s hearing several times to accuse the judge of being biased and chide his public defender for failing to interject.

He asked his attorney to question the editing of the video because “that’s not what happened at all.”

Prosecutors say Fernandez has a lengthy criminal history dating back to juvenile court in 1996. His convictions include seven separate assaults in Los Angeles, Kings and Kern counties, along with a DUI offense.

If convicted in this case, Fernandez could face up to 100 years to life in prison, according to prosecutors.