U.S. President Donald Trump greets supporters after arriving in Air Force One at LAX Airport on April 5, 2019 in Los Angeles, California.

The California Supreme Court overturned a new state law that sought to force President Donald Trump to release his closely guarded income tax returns in order to get on the presidential primary ballot in California next March.

The Supreme Court decision this week found that the state's constitution barred the law passed this year from requiring any presidential primary candidate to file five years' worth of federal income tax returns to get on the ballot.

Enforcement of that law — the first of its kind in the United States — already had been blocked by a federal court ruling in September that found the legislation violated the U.S. Constitution.

State officials were appealing that federal ruling. But a decision in the appeal would not have been issued in time for March's primary.

If the law had been upheld, Trump and other presidential contenders would have had to send the California secretary of state copies of their tax returns by next Tuesday if they wanted to appear on the ballot.

Trump's lawyers had previously said he would likely skip the primary rather than comply with the law if it were upheld.

The new ruling comes on the heels of repeated losses by Trump in federal courts, where he tried to bar a Democratic-led House committee and the Manhattan, New York, district attorney's office from getting access to his tax returns.

Trump, who has repeatedly resisted calls to release his tax returns despite having promised to make them public, now is asking the U.S. Supreme Court to block those efforts to get his returns.

Trump is the first president since Gerald Ford not to release his tax returns.