An attorney for President Trump agreed Wednesday that the commander-in-chief couldn’t be criminally prosecuted — even if he hypothetically shot someone on Fifth Avenue.

The rationale that Trump has blanket immunity came during arguments before the Second Circuit Court of Appeals, related to Manhattan DA Cyrus Vance’s attempts to subpoena Trump’s tax returns and other financial records.

During the 45-minute hearing, Vance’s lawyer Carey Dunne cited Trump’s statement from his 2016 campaign that “I could stand in the middle of Fifth Avenue and shoot somebody and I wouldn’t lose voters.”

“If he did, for example, pull out a handgun and shoot someone while on Fifth Avenue, what would be the impact of that? Would local police be disabled from restraining such a person? Or processing such a person?” Dunne asked during his arguments. “Would we have to wait for an impeachment proceeding to be initiated?”

That prompted one of the appeals judges, Denny Chin, to grill Trump attorney William Consovoy on the hypothetical.

“What’s your view on the Fifth Avenue example?” Chin asked. “Nothing could be done? That’s your position?”

Consovoy replied, “That is correct.”

Earlier this month, a district court threw out a lawsuit by Trump to stop Vance from obtaining his tax returns. The president has since appealed that dismissal, maintaining that he has an expectation of total immunity while in office.

The three-judge panel reserved decision Wednesday — but hinted that the legal battle could be far from over.

“This case seems bound for the Supreme Court,” said Chief Judge Robert Katzmann.