WASHINGTON (AP) — A federal judge on Wednesday acquitted a New Mexico man of misdemeanor charges that he illegally entered the U.S. Capitol and engaged in disorderly conduct after he walked into the building during last year’s riot.

U.S. District Judge Trevor McFadden issued the verdict from the bench after hearing testimony without a jury in the case against Matthew Martin. McFadden, who was nominated by former President Donald Trump, acquitted Martin of all four counts for which he was charged.

McFadden said it was reasonable for Martin to believe that outnumbered police officers allowed him and others to enter the Capitol through the Rotunda doors on Jan. 6, 2021. The judge also said Martin’s actions were “about as minimal and non-serious” as anyone who was at the Capitol that day.

Martin is the third Capitol riot defendant whose case has been resolved by a trial. He is the first of the three to be acquitted of all charges that he faced. The first two Capitol riot trials ended with convictions, although McFadden acquitted one of those defendants of a disorderly conduct charge after a bench trial last month.

In the same courthouse where Martin was acquitted, a fourth trial continued on Wednesday for a former Virginia police officer who is charged with storming the Capitol with another off-duty officer. Jurors heard testimony from the fellow officer, who pleaded guilty to a riot-related charge and agreed to be a witness for prosecutors.

Martin, whose bench trial started Tuesday, testified that a police officer waved him into the building after the riot erupted. A prosecutor dismissed that testimony as “nonsense.”

The judge, however, said video shows two police officers standing near the Rotunda doors and allowing people to enter as Martin approached. One of the officers appeared to lean back before Martin placed a hand on the officer's shoulder as a possible sign of gratitude, the judge said.

McFadden described Martin's testimony as “largely credible." The judge said it was not unreasonable for him to believe that officers allowed him to enter the Capitol, even though alarms were blaring and broken glass was strewn about the floor.

Martin was charged with four misdemeanor counts: entering and remaining in a restricted building, disorderly and disruptive conduct in a restricted building, violent entry and disorderly conduct in a Capitol building and parading, demonstrating or picketing in a Capitol building.

The judge said Martin appeared to be a “silent observer of the actions of others." McFadden didn't find any evidence that Martin intended to disrupt Congress from certifying President Joe Biden’s electoral victory.

Dozens of Capitol riot defendants have pleaded guilty and been sentenced, but Martin is the first to testify at a trial. His acquittal could embolden others to gamble on a bench trial, although McFadden so far is the only judge to preside over one and decide a case.

Martin said he “went with the flow” as he approached the Capitol and testified that he saw a police officer wave him into the building. Martin remained inside the Capitol for about 10 minutes after entering the building through the Rotunda doors, according to prosecutors.

Martin said he “enjoyed the day” of the riot.

“It was a magical day in many ways,” he testified on Tuesday before adding, “I know some bad things happened.”

“You understand that police officers died?” Justice Department prosecutor Michael Romano asked Martin.

At least nine people died in the riot or its aftermath. One officer died after he collapsed hours after being sprayed with bear spray and other officers who tried to quell the riot died by suicide in the months following the attack.

Prosecutors said Martin, an engineer, worked for a government contractor at the National Laboratory in Los Alamos, New Mexico, and held a top-secret security clearance on Jan. 6. Martin said he actually worked at a different facility in Los Alamos.

Defense attorney Dan Cron said Martin saw another person shake a police officer’s hand after entering the Capitol. Martin placed his hand on an officer’s shoulder “as a gesture of thanks and of good will,” Cron said.

Romano, the Justice Department prosecutor, said Martin joined the mob in crowding police officers who were trying to disperse the crowd. The prosecutor said Martin knew that he wasn’t allowed to be in the Capitol.

“The idea that he thought he had permission to do that is nonsense,” Romano said.

Other riot defendants have claimed police waved them in or said they could enter.

McFadden presided over a bench trial last month for Cuoy Griffin, a county official in New Mexico. The judge on March 22 convicted Griffin of illegally entering restricted U.S. Capitol grounds but acquitted him of engaging in disorderly conduct.

On March 8, a jury decided the first Capitol riot trial by convicting a Texas man, Guy Reffitt, of storming the Capitol with a holstered handgun.

After Martin's acquittal Wednesday, a jury in a different courtroom heard a second day of testimony for the trial of former Rocky Mount, Virginia, police officer Thomas Robertson. The town fired Robertson and another officer, Jacob Fracker, who joined him at the Capitol on Jan. 6.

Fracker was scheduled to be tried alongside Robertson before he pleaded guilty last month to a conspiracy charge and agreed to testify against somebody who was his mentor and a father figure.

“I absolutely hate this,” Fracker said. “I've always been on the other side of things, the good guys' side so to speak."

Fracker testified that he and Robertson both believed the 2020 presidential election had been stolen from Trump. Fracker said they both wore gas masks as they joined a mob in storming the Capitol.

Asked why he went to the Capitol that day, Fracker said he wanted to play a part in overturning the election results.

“I felt like we had maybe been heard by whoever it was we needed to be heard by,” Fracker said.

He said he has grown ashamed of his actions on Jan. 6.

“That's not the person I am,” he said. “I wasn't raised like that.”

Fracker is due to be cross-examined by one of Robertson's lawyers on Thursday.

Prosecutors plan to call two more witnesses, a police officer and FBI agent. A defense attorney said Robertson may testify. Jurors could hear attorneys' closing arguments as soon as Friday.

More than 770 people have been charged with riot-related federal crimes. Over 240 of them have pleaded guilty, mostly to misdemeanors, and over 140 of them have been sentenced.

Copyright 2022 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.