By Karen Freifeld and Jonathan Stempel

NEW YORK (Reuters) - Donald Trump cannot block a prosecutor's subpoena for eight years of his tax returns, a federal judge ruled on Thursday, in the latest setback in the U.S. president's longstanding effort to keep his finances under wraps.

U.S. District Judge Victor Marrero in Manhattan rejected Trump's claims that the grand jury subpoena from Manhattan District Attorney Cyrus Vance to the president's accounting firm Mazars USA was "wildly overbroad" and issued in bad faith.

In a 103-page decision, Marrero also said letting Trump block the subpoena, which was issued last August, would amount to an "undue expansion" of presidential immunity.

"Justice requires an end to this controversy," Marrero wrote.

Trump quickly appealed the decision and filed an emergency motion to delay turning over his tax returns, saying enforcing the subpoena would cause him irreparable harm by disclosing his "private, confidential information."

The litigation and grand jury secrecy rules make it unlikely Trump's financial records will become public before Nov. 3, when the president is seeking reelection.

Speaking to reporters at the White House, Trump said the case will likely head back to the Supreme Court, which on July 9 rejected his earlier argument he was immune from state criminal probes while in office.

The Supreme Court said the Republican president could still challenge the subpoena on other grounds. Marrero had also ruled last October that Vance, a Democrat, could enforce the subpoena.

"This is a continuation of the most disgusting witch hunt in the history of our country," Trump told reporters. "This is the ultimate fishing expedition."

A spokesman for Vance declined to comment.

Trump has long fought efforts by lawmakers and prosecutors to obtain those records, and by withholding his tax returns has departed from the decades-long practice of his predecessors.

The subpoena is related to Vance's criminal probe into Trump and his Trump Organization.

In a court filing this month, Vance suggested the subpoena was related to "possibly extensive and protracted criminal conduct at the Trump Organization," including alleged insurance and bank fraud.

Marrero accepted Vance's argument that letting Trump delay the subpoena's enforcement would effectively give the president "absolute temporary immunity" from the probe while in the White House.

Unless enforcing the subpoena would affect his constitutional duties, "the President is entitled to claim no greater shield from judicial process than any other person," Marrero wrote.

Vance's probe began after reports that Trump's former lawyer Michael Cohen paid pornographic film actress Stormy Daniels $130,000 to buy her silence before the 2016 election about claimed sexual encounters with Trump, which he has denied.

The case is Trump v Vance et al, U.S. District Court, Southern District of New York, No. 19-08694.

(Reporting by Karen Freifeld and Jonathan Stempel; additional reporting by Jeff Mason in Washington. Editing by Alistair Bell)

tag