NEW YORK — President Trump’s private attorney said Wednesday that the president could not be investigated or prosecuted as long as he is in the White House, even for shooting someone in the middle of Fifth Avenue.

The claim of “temporary presidential immunity” from Trump’s private attorney William S. Consovoy came in court in response to a judge’s question that invoked the president’s own hypothetical scenario. As a candidate in 2016, Trump said his political support was so strong he could “stand in the middle of Fifth Avenue and shoot somebody” and not “lose any voters.”

The president’s lawyer was asking the U.S. Court of Appeals for the 2nd Circuit to block a subpoena for Trump’s private financial records from New York prosecutors investigating hush-money payments made before the 2016 election. The judges seemed skeptical of the president’s sweeping claims of immunity from not just prosecution but also investigation.

In May, the Treasury Department refused a statutory and subpoena request for President Trump’s tax returns. Now, it’s unclear whether Democrats will get them. (JM Rieger/The Washington Post)

Judge Denny Chin pressed Consovoy about the hypothetical shooting on the streets of Manhattan.

“Local authorities couldn’t investigate? They couldn’t do anything about it?” he asked, adding, “Nothing could be done? That is your position?”

“That is correct,” Consovoy answered, emphasizing that such immunity would apply only while Trump is in office.

The exchange came during an hour-long argument centering on Trump’s effort to fend off a subpoena to his longtime accounting firm from Manhattan District Attorney Cyrus Vance Jr. Vance is seeking eight years of Trump’s tax returns from the firm, Mazars USA, among other documents. Unlike past presidents and presidential nominees, Trump has refused to release any of his tax returns.

The case is a test of the sweep of presidential privilege and one of several battles over Trump’s business records that began before the House opened its impeachment inquiry. As with the other disputes, this one seems destined for the Supreme Court, which could hear the case as early as this term.

Several legal experts said the assertion by Trump’s lawyer that the president would be immune from investigation, even in an extreme case such as murder, was a stretch and ultimately should not be validated by the courts. But it was not surprising. That is the logical progression of the argument the president’s attorneys have been making all along in court filings, they said.

“This had always been where the argument led, but now that it’s out in the open, hopefully everyone understands just how dangerous it is,” said Steve Vladeck, a University of Texas at Austin law professor and constitutional expert.

Trump’s argument could “easily allow the president to get away with major crimes. It’s not enough to say that they could investigate after he leaves office, since evidence can disappear or spoil if it isn’t collected promptly,” said Cornell Law School professor Josh Chafetz.

Trump’s immunity claim, the experts said, extends not only to himself, but also to his business, the Trump Organization.

Consovoy said in court Wednesday that the president objects to the entire subpoena, not just the request for Trump’s tax records, because the company is “wholly owned by the president and they do hold his personal records.”

According to Justice Department legal opinions, sitting presidents cannot be charged by federal prosecutors. Trump’s lawyers have taken that a step further, saying the president cannot be investigated by any prosecutor. But Vance, an elected district attorney, is not bound by the federal guidelines and has discretion to bring charges in New York state courts.

Judge Robert A. Katzmann asked what harm would come from turning over the president’s tax records to a grand jury when state and federal officials already retain such documents.

Consovoy said there was no guarantee the records would remain private once prosecutors and a grand jury were granted access.

In response, the district attorney’s office noted that the private business records they are seeking predate Trump’s tenure as president. Carey Dunne, general counsel for the Manhattan District Attorney’s Office, told the court “there is no such thing as presidential immunity for tax returns” and that “they’re making this up.”

Dunne added: “[President Trump] may view them as embarrassing or sensitive, but tax returns do in fact get subpoenaed all the time in financial investigations.”

Earlier this month, U.S. District Judge Victor Marrero rejected Trump’s broad claims of immunity and refused to block the subpoena. The judge said such a shield for the president would be “virtually limitless” and characterized Trump’s argument as “repugnant to the nation’s fundamental structure and constitutional values.”

The subpoena for records from Mazars USA remains on hold while the appeals court reviews the case. Vance’s office agreed to pause enforcement of the subpoena if the president loses his appeal, so long as the president abides by an expedited timeline to ask the Supreme Court to intervene.

The appeal Wednesday was heard by three judges — Katzmann, Chin and Christopher F. Droney — all of whom were nominated by Democratic presidents.

Droney questioned why Trump should be allowed to block a subpoena for his tax returns when the Supreme Court had ordered the White House to hand over President Richard Nixon’s audiotapes during the Watergate investigation.

Consovoy said the cases differed in important ways and that if this case were allowed to move forward, it could unleash myriad investigations of future presidents from state and local prosecutors.

“The idea that this would not lead to a greater investigations of the president” was not believable, Consovoy said.

In August, Vance subpoenaed Mazars USA as part of his examination into whether any state laws were broken in connection to the 2016 payments to two women who said they had had affairs with Trump years earlier.

Trump has denied the affairs and any wrongdoing in connection to the payments. The president’s lawyers say it is unprecedented for a local prosecutor to seek the records of a sitting president. His legal team has called the subpoena to Mazars “a bad faith effort to harass the President by obtaining and exposing his private financial information, not a legitimate attempt to enforce New York law.”

The lawsuit is one of three cases in which Trump has sued investigators and the companies they subpoenaed to try to block access to his financial records. In the two other cases, Trump faces investigations that predate impeachment proceedings from congressional committees seeking his tax returns and financial documents.

A federal appeals court in Washington this month ruled against the president and refused to block a House committee subpoena for Trump’s records from Mazars. In that case, the court upheld Congress’s oversight powers and broad authority to issue subpoenas for information.

In the New York case, the Justice Department has backed the president’s position that the subpoena from Vance’s office should be blocked. But the government lawyers did not fully embrace Trump’s assertion that he is immune from all investigation.

“A subpoena directed at the president’s records should be permitted only ‘as a last resort,’ ” the Justice Department said in its filing.

The local investigation followed the conviction last year of Trump’s former attorney Michael Cohen. He pleaded guilty to federal campaign finance violations for helping arrange payments to Stormy Daniels and Karen McDougal to keep their allegations of affairs with Trump from becoming public before the election.

Cohen has said Trump directed the payments and reimbursed him.