WASHINGTON — The shake-up of President Trump’s legal team yesterday sets up a dramatic showdown between the president and special counsel Robert Mueller — one that will either end with a face-to-face meeting, or a constitutional crisis if Trump defies the threat of a subpoena.

Trump brought in former Clinton impeachment attorney Emmet Flood to his legal team as attorney Ty Cobb announced his departure, while former New York City Mayor Rudolph Giuliani signaled publicly that Trump would only sit down with Mueller’s team for a few hours total, with a limited scope of questioning.

But it’s up to Mueller to agree to those terms. Mueller already warned members of Trump’s team that he may subpoena Trump to compel his testimony if he refuses to comply voluntarily.

Just how such a showdown would end is a legal uncertainty — and a fight that could protract the investigation as the justices of the U.S. Supreme Court weigh in to settle the limits of a special counsel’s powers.

That backdrop gives both parties some incentive to work out a deal.

“I think everyone would like to avoid a constitutional crisis that could result if Trump refuses to comply with the subpoena and is held in contempt,” said former U.S. Attorney Barbara McQuade, now a University of Michigan law professor. “How do you enforce the contempt order? Send U.S. Marshals to go arrest him? What does Secret Service do in that instance — allow the arrest or protect the president?”

Still the replacement of Cobb with Flood and Trump’s own Twitter feed suggests that the president is ready to take a more combative tone, ending the more cooperative approach Cobb advocated.

Trump railed against his Justice Department in a tweet yesterday: “At some point I will have no choice but to use the powers granted to the Presidency and get involved!”

Experts said cooperation could bring Trump more benefits than just avoiding a constitutional battle.

“The payoff of cooperation is largely subpoena avoidance and some additional logistical accommodations for the president,” said Andrew Wright, former associate White House counsel.

Mueller’s likely desire to save the subpoena power as a last resort “gives Giuliani a little bit of leverage to demand terms, such as using an informal interview with lawyers present instead of a formal grand jury appearance and limiting the duration of an interview,” McQuade said.

But given the substance of the questions Mueller reportedly will focus on, it may be to Trump’s advantage to just voluntarily meet with him.

“They don’t cover topics that weren’t already in the press,” said former federal prosecutor Renato Mariotti. “It’s not like there were a dozen questions about a land deal we had never heard of.”