Image copyright Getty Images Image caption Mr Trump said he would make his tax returns public during the 2016 campaign

A judge has ordered US President Donald Trump to hand over eight years of his tax returns to New York investigators.

The judge rejected arguments by the president's lawyers that Mr Trump enjoyed total immunity while in office.

The ruling helps an investigation into hush money paid to two women who claim they had affairs with Mr Trump.

Prosecutors said in a court filing that every US president since Jimmy Carter had voluntarily released his tax returns before or upon taking office.

In his 75-page decision on Monday, Judge Victor Marrero called the president's claim of immunity "repugnant to the nation's governmental structure and constitutional values", writing that he would not allow a "categorical and limitless assertion of presidential immunity from judicial process".

"The only thing truly absolute about presidential immunity from criminal process is the Constitution's silence about the existence and contours of such an exemption," he wrote.

The president tweeted about the ruling on Monday, claiming that Democrats were "pushing local New York City and State Democrat prosecutors to go get President Trump".

Will the tax returns now be released?

No, because the president's lawyers immediately filed an appeal, and the 2nd US Circuit Court of Appeals granted a temporary stay of Judge Marrero's ruling "pending expedited review" by the court.

If the judge's ruling is not overturned, the New York state district attorney can enforce an earlier legal demand he issued to Mr Trump's accountants for the tax returns, personal and corporate, from 2011-18.

But these records may not become public even if the appeal fails, as they would be protected by the state's grand jury case laws.

What's the background?

The investigation concerns alleged hush money payments made by Mr Trump's former lawyer Michael Cohen to two women - adult film star Stormy Daniels and former Playboy model Karen McDougal - who both say that they had affairs with Mr Trump. The president denies the affairs took place.

Manhattan district attorney Cyrus Vance Jr is looking into whether Mr Trump's organisation broke any election campaign laws by reimbursing Mr Cohen for the payments.

Mr Vance said that the president had "not been identified as a defendant nor is there an assumption he will be", the Washington Post reported.

Media playback is unsupported on your device Media caption Was Trump's Stormy Daniels payment legal?

The alleged payments to Ms Daniels and Ms McDougal were not reported to the Federal Election Commission during the campaign. The question is whether the payments were made to protect Mr Trump's personal reputation or to protect his image as a presidential candidate.

Under US election rules, any payments made with the aim of influencing a vote must be reported.

Mr Cohen this year pleaded guilty to violating laws during the 2016 election over his handling of the hush money, and is currently serving a three-year federal prison sentence for the finance violation and other crimes.

But Mr Trump has insisted the payment was legal and did not come from campaign finances. He has also accused his former fixer of making up stories to receive a lighter sentence.

The Republican president's lawyers have criticised the investigation as politically motivated, pointing out that Mr Vance is a Democrat.

Image copyright Getty Images Image caption Stormy Daniels (left) and Karen McDougal have alleged affairs with the president

There have been a number of attempts to obtain Mr Trump's tax returns. He is also appealing against a case to block Deutsche Bank from complying with subpoenas issued by the Democratic-controlled House of Representatives, which is investigating the Trump family's financial dealings.

Earlier this month, a judge temporarily blocked a new California law that would have mandated Mr Trump release his personal income tax returns in order to appear on the 2020 presidential ballot. California's secretary of state has promised to appeal.