A Manhattan federal judge on Thursday cleared former New York City Comptroller Brad Lander of charges he obstructed an elevator at a downtown immigration detention center last year, handing the congressional candidate a legal victory only three days before the start of early voting.

Magistrate Judge Henry Ricardo said he could not find any evidence of “actual obstruction” of an elevator at 26 Federal Plaza. “The government failed to prove its case,” Ricardo said from the bench following a day-long trial.

The acquittal comes as Lander, a progressive Democrat, challenges Rep. Dan Goldman to represent Lower Manhattan in Congress. The alleged offense was relatively minor, but the trial drew intense scrutiny, with observers spilling into an overflow room at the federal courthouse to watch the proceedings.

Lander has made his court-watching activities at 26 Federal Plaza a key part of his recent campaigns. A video depicting the first time he was arrested while accompanying a man to immigration court gave him a huge boost in last year’s mayoral primary, which he ultimately lost. Many rival mayoral candidates and activists rushed to Foley Square to support Lander and condemn ICE.

“I feel genuinely moved by the rule of law,” Lander said after Thursday's verdict. ”What a blessing to live in a country where if the government arrests you and charges you with something, you could count on the ability to go in and make the government prove its case.”

The single charge stemmed from a September protest at 26 Federal Plaza. U.S. Immigration and Customs Enforcement has used the 41-story federal complex to hold detainees amid President Donald Trump’s deportation campaign, in conditions a federal judge has described as crowded and inhumane.

Lander and 10 other elected officials were arrested while demanding access to the holding cells on the 10th floor.

Lander's arrest during last year's mayoral primary was the biggest moment of the former comptroller's campaign.

Most defendants had their charges dismissed on the condition they not be arrested protesting at a federal facility for six months. Lander chose to plead not guilty and go to trial.

A strange air hung over the courtroom Wednesday, with the judge and defense attorneys acknowledging how rare it was for such a low-level criminal violation to advance to trial.

In opening statements, defense attorney Michael Bass said while Lander’s case may appear narrow, it was actually “critically important.”

“Arrest is the bludgeon of suppression,” he said. “This case is yet another example of the current administration’s suppression of dissent.”

At issue was whether Lander unreasonably obstructed the “usual use” of the building’s elevator while sitting on the floor protesting.

“He ignored a warning to move, and instead started chanting the phrase, ‘we shall not be moved,’” Assistant U.S. Attorney Ariel Cohen said in her opening statement.

Lander took the stand to testify in his own defense. He said he and the other elected officials sat on the floor to wait to be let into the ICE facility — which they felt they had a duty to oversee.

“We thought it might be a while,” Lander said. “Of course I would have moved to let someone off the elevator.”

During the brief and tense cross-examination, Cohen showed a photo of Lander sitting in front of the closed elevator doors and asked Lander if he recognized himself in the photo. “Yes,” Lander replied.

Cohen asked if, in fact, those were elevator doors behind him. “Yes,” Lander replied again.

“No further questions,” Cohen said.

In the end, Ricardo, the judge in the case, found the government did not do enough to prove Lander unreasonably obstructed any movement, saying there was “no evidence anyone tried to exit from that elevator.”

Lander hugged his legal team following the verdict, before walking to the public gallery to kiss his wife.

Goldman, Lander’s opponent in the primary for New York’s 10th Congressional District, criticized Lander’s decision to take his case to trial as a fundraising ploy.

“Our immigrant neighbors deserve someone who will fight and win for them, not a career politician who will fundraise off of a performative, self-promoting case that helps no one in the immigrant communities in the district,” Goldman said in a statement.

In response, Lander said he chose to plead not guilty “because I did not believe that we had done what we were charged with, and I did not want to accept that I couldn't go back and protest at 26 Federal Plaza.”

Prosecutors “could have dropped the charges at any moment,” he added. A spokesperson for the U.S. attorney’s office did not immediately respond to a request for comment.