A commission meant to oversee the conduct of local prosecutors was deemed unconstitutional by a state Supreme Court on Tuesday, handing a victory to the state's district attorneys who had challenged the creation of the panel.

Justice David Weinstein in the ruling found that "to impose discipline on attorneys for violations of the Rules of Professional Conduct" violates specific passage of the state constitution.

“This case was never about whether the conduct of state prosecutors could or should be overseen," said Jacob Gardner, an attorney who represented the District Attorneys Association of New York, which backed the lawsuit challenging the law. "It was solely about whether the method of oversight chosen by the legislature is constitutional. As the court held, it is not.”

State lawmakers in a surprising show of bipartisanship in 2017 approved the creation of the measure, joining Democrats who have been critical of prosecutors in criminal cases with Republicans who controlled the state Senate at the time, including the now-retired Sen. John DeFrancisco.

GOP lawmakers like DeFrancisco had been concerned with the lack of oversight for prosecutors and had sought the creation of a commission similar to the one that oversees judges in New York. But district attorneys argued the commission created by the legislature was an entirely different entity that could hamper lawful prosecutions and violated the constitution.

The victory for the DAs comes amid a push to alter the state's new cash bail law, which ended cash bail requirements for misdemeanor and non-violent felony offenses.

District attorneys and law enforcement officials have met with Democratic lawmakers in the state Senate in recent days about possible changes.