California Gov. Gavin Newsom signed legislation Tuesday requiring President Donald Trump to publicly release his tax returns before he can appear on the state's primary ballot in 2020.

The bill, known as the "Presidential Tax Transparency and Accountability Act," would also apply to gubernatorial candidates and requires the release of tax returns for the most recent five years. The measure sailed through the state's Democratic-led legislature.

"These are extraordinary times and states have a legal and moral duty to do everything in their power to ensure leaders seeking the highest offices meet minimal standards, and to restore public confidence," the Democratic governor wrote in his signing statement.

HOUSE COMMITTEE SUES TRUMP ADMIN FOR PRESIDENT'S TAX RETURNS

"As one of the largest economies in the world and home to one in nine Americans eligible to vote, California has a special responsibility to require this information of presidential and gubernatorial candidates," Newsom continued, adding that the law is constitutional because "the United States Constitution grants states the authority to determine how their electors are chosen."

Trump campaign official Tim Murtaugh called the law unconstitutional.

“The Constitution is clear on the qualifications for someone to serve as president and states cannot add additional requirements on their own,” Murtaugh said in a statement. "What's next, five years of health records?"

He said the law violates the First Amendment right of association since states can't tell political parties which candidates their members can or cannot vote for in a primary election.

Jay Sekulow, counsel to the president, said in a statement that "the State of California’s attempt to circumvent the Constitution will be answered in court.”

CUOMO SIGNS BILL ALLOWING CONGRESS TO GET TRUMP TAX RETURNS

While states have authority over how candidates can access the ballot, the U.S. Constitution lays out a limited set of qualifications someone needs to meet to run for president, such as the requirement that they are at least 35 years old. The Supreme Court has previously stopped state efforts to add requirements on congressional candidates through ballot access rules.

The law will require candidates to submit their tax returns to the California Secretary of State at least 98 days before the primary, which will be held on March 3, 2020.

Trump has bucked decades of precedent by not releasing his tax returns, something the major 2020 Democratic contenders have already done. Transparency advocates argue voters have a right to know a political candidate's financial dealings.

A similar measure was vetoed in 2017 by former California Gov. Jerry Brown. Before becoming governor, Newsom called Trump out for not releasing his tax returns and repeatedly indicated he may be trying to hide damaging information.

CLICK HERE TO GET THE FOX NEWS APP

Earlier this month, Trump sued the House Ways and Means Committee and New York officials for their efforts in trying to obtain his returns.

But even if the California law withstands a likely legal challenge, Trump could avoid the requirements by choosing not to compete in California's primary. With no credible GOP challenger at this point, he likely won't need California's delegates to win the Republican nomination.

The Associated Press contributed to this report.