BUFFALO, N.Y. -- A judge on Tuesday dismissed all criminal charges against State Sen. Robert Ortt, a Republican from Niagara County.

Ortt had pleaded not guilty to multiple felonies after a grand jury indicted him on three counts of offering a false instrument for filing.

State Attorney General Eric Schneiderman's office prosecuted the case and accused Ortt, the former North Tonawanda mayor, of padding his mayoral salary through a no-show job for his wife, who was indirectly paid $21,500 over four years by the Niagara County Republican Committee.

In his ruling, Judge Peter Lynch said prosecutors provided "no evidence whatsoever that Defendant Ortt knew the source of monies paid... to Meghan Ortt was NCRC."

Lynch's decision faulted prosecutors from state Attorney General Eric Schneiderman's office for their presentation to the grand jury, saying it didn't contain any direct evidence that Ortt knew the payments were actually coming from the county GOP.

Lynch wrote, "The Court has inspected the Grand Jury minutes and finds the evidence before the Grand Jury was legally insufficient to establish the offenses changed..."

He continued, "It is this court's view, that there was no valid line of reasoning and permissible inferences which could lead a rational Grant Juror to issue an Indictment in this case."

The ruling was a major legal victory for Ortt, who had maintained his innocence while publicly and repeatedly accusing Schneiderman, a Democrat, of pursuing a headline-grabbing prosecution for political purposes.

Ortt was charged in March along with his predecessor, former Sen. George Maziarz, who was charged in a separate alleged scheme and will face trial August 21.

Ortt, previously the North Tonawanda treasurer, faced a $5,000-a-year pay cut when he was elected mayor in 2009.

Schneiderman alleged the Niagara County GOP made payments to a pair of politically connected marketing companies that then passed the money to Meghan Ortt, who performed no work for the pay.

The payments, which were spread over four years, were to cover Rob Ortt's pay cut, according to prosecutors.

Lynch ruled, however, that the evidence did not show Ortt had knowledge that the payments were actually coming from the Niagara GOP, nor did it show Ortt had knowledge of the committee's campaign-finance filings, which are at the center of the charges.

In a statement, Ortt praised the judge's decision.

"This quick and forthright dismissal exposed Eric Schneiderman for the power hungry, political opportunist that he is," Ortt said. "It is my hope that this ruling today will force Mr. Schneiderman to think twice before concocting baseless charges to serve his own radical progressive political agenda again. My wife and I look forward to receiving a personal apology from Mr. Schneiderman."

A spokesperson for Attorney General Schneiderman pointed out the judge upheld the charges against Senator George Maziarz, who was indicted by the same grand jury. He's accused of shielding $95,000 in secret campaign payments to a former staffer who was previously accused of sexual harassment. The trial for Maziarz is set for August 21st.

"We're pleased that a trial date has been set for the corruption charges against Sen. Maziarz," said A.G. spokesperson Amy Spitalnick. "We disagree with the opinion regarding Sen. Ortt and are considering our options. Nothing in today’s opinion changes the fact that Meghan Ortt received money for a politically-connected no-show job. Only in Albany would a Senator argue that receiving money for a politically-connected no-show job isn’t a crime."

Ortt responded in an interview with 2 on Your Side saying "Disgusting that they would go after my wife. Disgusting they would make a sexist comment like that in my view. That only through me could she get some type of job which was never the case."

Ortt was elected in November 2014 to replace Maziarz in the 62nd District State Senate seat which covers portions of Niagara and Orleans Counties. Maziarz had stepped aside after a long term in the State Senate in which he rose to one of the top GOP positions. When asked if he was concerned if anything in the Maziarz trial could affect him, Ortt responded "The two cases were totally separate so I'm not at all concerned about whatever might happen in his case that could impact me."