Police arrested a 30-year-old man on suspicion of attempted murder on Friday after he stabbed two male police officers inside a courtroom in Sendai, Miyagi Prefecture.

The incident occurred shortly after Seiji Yodogawa, who was appearing as the defendant in a trial at the Sendai District Court, was given a sentence of one year in prison for taking photos up a woman's skirt.

The injuries sustained by the two officers, one 42 and the other 44, were not life-threatening.

As the defendant was on bail he did not go through a body check before entering the courtroom, according to the police.

They said that while his verdict was still being read, Yodogawa suddenly turned and crossed over a barrier into the gallery at the back of the room, before brandishing a knife and stabbing the officers, one in the back and one in the face.

He was arrested on the spot after spectators in the gallery helped restrain him. He was found to be carrying three fruit knives and two box cutters, the police said.

No metal detector had been used at the court during the trial.

During his frenzy, the defendant was heard criticizing the nation's criminal justice system, but he has since remained silent during questioning by investigators.

Yodogawa was on trial for violation of a local ordinance after being arrested earlier this year for allegedly taking upskirt photos of a senior high school girl on a train platform in Sendai.