CNN  — 

The California Supreme Court on Thursday unanimously ruled the state’s new law that requires presidential candidates to disclose their tax returns for the previous five years to get on the ballot is invalid.

The ruling is a win for President Donald Trump, who is resisting efforts to turn over his tax returns.

California Gov. Gavin Newsom signed the law in July, and it was immediately challenged in court by the President, Republican voters, the Republican National Committee and the Republican Party of California.

Chief Justice Tani Gorre Cantil-Sakauye wrote in the opinion that the law “is in conflict with the Constitution’s specification of an inclusive open presidential primary ballot.”

“The Legislature may well be correct that a presidential candidate’s income tax returns could provide California voters with important information,” Cantil-Sakauye wrote. But, she argues, the state Constitution says that “ultimately, it is the voters who must decide whether the refusal of a ‘recognized candidate throughout the nation or throughout California for the office of President of the United States’ to make such information available to the public will have consequences at the ballot box.”

The Presidential Tax Transparency and Accountability Act requires a candidate for president or California governor to file copies of their Internal Revenue Service returns for the most recent five years at least 98 days ahead of the primary election. In 2020, the California primary falls on March 3, so the deadline to submit returns would be November 26.

A federal judge in California blocked the law in October. US District Judge Morrison C. England Jr. of the Eastern District of California wrote “the Act’s provisions likely violate the Constitution and the laws of the United States” and argued the law would set a dangerous precedent.

Lawyers for Trump had argued in court papers that the law adds an “unconstitutional qualification” to the fixed set of qualifications for the presidency set forward in the Constitution and violates the First Amendment.

Other states, including New York, Illinois and Washington, have also pushed state legislation requiring candidates to release their individual tax returns to qualify for the presidential primary ballot.

Trump’s team of private lawyers has filed lawsuits in federal courts across the country to stop House Democrats from seeking the President’s tax returns. Trump broke with tradition and refused to voluntarily release his tax returns in 2016, which prompted questions and lawsuits about potential conflicts of interest.

Earlier the month, an appeals court denied for the second time Trump’s attempt to stop an accounting firm from turning over his financial documents to the House. That decision was a loss for Trump, after federal judges have repeatedly rebuked him and greenlighted the House’s effort. If Trump loses again with the Supreme Court, the case could deliver his tax returns or closely related financial documents to House Democrats.

CNN’s Ariane de Vogue, Katelyn Polantz and Paul LeBlanc contributed to this report.