Farzad Fazeli is accused of trying to attack Republican congressional candidate Rudy Peters with a switchblade. He was arrested on suspicion of assault and criminal threats. (Alameda County Sheriff's Office)

Authorities have arrested a 35-year-old man on suspicion of trying to attack a Republican congressional candidate with a switchblade at a festival in Castro Valley.

The incident occurred at the Castro Valley Fall Festival about 3:45 p.m. Sunday, when the man approached Rudy Peters at his campaign booth and made disparaging remarks about his political party and elected officials, according to the Alameda County Sheriff’s Office.

The suspect — identified as Farzad Fazeli — pulled out a switchblade and tried to stab Peters, but the knife malfunctioned and a struggle ensued, the sheriff’s office said. Peters was not seriously injured.

Deputies detained Fazeli and confiscated the switchblade shortly after he fled the scene.

Fazeli was arrested and booked on suspicion of assault, criminal threats, brandishing a weapon and possession of a switchblade knife. The case was sent to the Alameda County district attorney’s office for review.

Swalwell released a statement Tuesday on Twitter condemning the violence.

“I’m glad to hear Mr. Peters is OK. But it’s NEVER OK to use violence to settle political disagreements [or any disagreement],” Swalwell said.