A Hartford Superior Court judge ruled Wednesday that there wasn’t enough evidence to overturn the results of the Hartford Democratic primary between state Rep. Kenneth Green and Hartford City Councilman Matthew Ritter.

When the votes were tallied on Aug. 10, Green had won by two. But a mandatory recount called four votes into question, and swung the election over to Ritter by a slim two-vote margin.

Judge A. Susan Peck upheld the results of the recount in her ruling from the bench Wednesday.

Green challenged the recount and the election, claiming election officials made egregious errors that jeopardized the entire election. He said that if Judge Peck ruled in his favor, she should order a new election.

Ordering a new election is something that has only happened twice in Connecticut’s history. But Judge Peck said she recognized the urgency of the case, so she issued an oral decision before releasing one in writing next week.

“This case highlights the intricacies of our democracy,” she said. “Elections are designed to ascertain the will of the people and to ensure the will of the people is carried out.”

Green’s attorney, Steven Seligman, argued previously in court that irregularities and mistakes made by election officials such as Anne Wall, the Democratic registrar of voters in Bloomfield, jeopardized the entire election.

Wall failed to ask Green for a list of people he would like at polling places to monitor the voting process. Green believed this caused him to lose the few votes he needed and would have otherwise received if he had chosen election officials.

Judge Peck ruled the irregularities fell short of providing enough evidence to overturn an entire election. She said she is not convinced that the recount failed solve any lingering issues. Green therefore failed to show enough evidence of substantial violations and mistakes placing the election in jeopardy.

“I think we were confident that she would reach that result,” said Daniel Krisch, Ritter’s attorney with Horton, Shields and Knox. “We felt the election was fair and that the problems were really minor.”

“It’s been a tough couple of weeks for me and my family,” Ritter said. “But I’m finally happy to have closure on this and to move on.”