The Justice Department asked a federal appeals court on Friday to stop the release of President Trump’s tax returns to the Manhattan district attorney’s office, arguing that local prosecutors should have to meet a very high legal bar before investigating a sitting president.

The filing meant Mr. Trump’s own Justice Department was lending support to his attempt to block a subpoena demanding eight years of his personal and corporate tax returns. The district attorney’s office issued the subpoena to Mr. Trump’s accounting firm in late August as part of an investigation into hush-money payments made before the 2016 presidential election.

But in its filing, the Justice Department, which is led by Attorney General William P. Barr, stopped short of endorsing Mr. Trump’s most sweeping argument: that sitting presidents are totally immune from all criminal investigations.

Mr. Trump’s lawyers had made the argument in a lawsuit attempting to shield his tax returns from the Manhattan district attorney, Cyrus R. Vance Jr.