(Reuters) - U.S. President Donald Trump sued California on Tuesday over a new law requiring presidential candidates to release their tax returns to run in the state’s primary elections.

FILE PHOTO: U.S. President Donald Trump speaks about the shootings in El Paso and Dayton in the Diplomatic Room of the White House in Washington, U.S., August 5, 2019. REUTERS/Leah Millis

The lawsuit, filed by Trump’s personal lawyers in federal court in Sacramento, argues the statute signed into law last week is unconstitutional because it sets up illegal new rules governing who can seek the presidency.

The complaint also alleged that the law retaliates against Trump for his apolitical beliefs and therefore violates his right to free speech under the First Amendment of the U.S. Constitution.

The lawsuit follows a similar one filed by Judicial Watch, a Washington-based conservative legal group, on behalf of four voters registered in California - two Republicans, a Democrat and an independent.

The Republican Party also filed a similar case on Tuesday.

The measure requires presidential candidates to release five years of tax returns in order to appear on a nominating ballot in California, the most populous U.S. state. The bill passed both houses of California’s Democrat-controlled legislature and was signed by Democratic Governor Gavin Newsom last week.

Trump refused to release his tax returns during the 2016 campaign, bucking a practice followed by every presidential nominee for decades.

Last month, the Democrat-controlled Ways and Means Committee of the U.S. House of Representatives sued the U.S. Treasury Department to force the release of Trump’s tax records. Democrats want the tax returns as part of their inquiry into possible conflicts of interest posed by Trump’s continued ownership of his extensive business interests.

In New York, Governor Andrew Cuomo, also a Democrat, signed an amendment last month to a law requiring the state’s Department of Taxation and Finance to release any returns sought by the congressional committees.

Both efforts have been rebuffed by Trump’s team. The president sued to block the New York law, and Treasury Secretary Steve Mnuchin has refused to hand Trump’s returns over to the Ways and Means Committee.

An earlier version of the California law had been vetoed by Newsom’s predecessor Jerry Brown, a Democrat who expressed concerns over its constitutionality.

“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,” Newsom said in a statement when he announced the bill signing last week.