From Day One, President Trump has been fighting a war for survival on two fronts. One front involves law enforcement, led first by James Comey’s FBI and now by special counsel Robert Mueller. The other front is political, where Trump faces the resistance movement led by congressional Democrats.

But sift through the fog of last week’s dizzying headlines about guilty pleas, immunity deals and possible impeachment, and a clear picture emerges: The two fronts have united, with the anti-Trumpers in the Justice Department and those in politics now openly working hand-in-hand against him.

In the long slog to unseat the president, the official merger of the anti-Trump forces marks a dramatic turning point. For one thing, it shows beyond doubt that the Mueller probe is fundamentally tainted by partisan politics, with the latest example involving Michael Cohen, Trump’s former lawyer. Inexplicably, Cohen’s case remains in control of Manhattan federal prosecutors.

The US attorney Trump appointed for that outpost, Geoffrey Berman, reportedly was ordered to recuse himself by Deputy Attorney General Rod Rosenstein, leaving the office staffed mostly by holdovers from Preet Bharara’s tenure.

Bharara was fired by Trump when he refused to resign and is cheering for Trump’s fall. Meanwhile, his former colleagues made the politically charged demand that Cohen accuse the president of criminal behavior in his own plea documents, illustrating how Cohen is a pawn and Trump is the real target.

The anti-Trump alliance also raises the stakes even higher in the midterm elections. Every match-up will be a referendum on him, and if Republicans lose either house of Congress, his power ebbs and his troubles instantly expand.

Perhaps most remarkable of all, this new legal-political landscape shows the power wielded by Lanny Davis, a decades-long friend, lawyer and fixer to Bill and Hillary Clinton.

With Davis serving as Cohen’s lawyer, the Clinton machine is effectively directing much of the assault on the president. After brokering Cohen’s deal with prosecutors, Davis began a televised barnstorming tour where he declared that because Cohen said Trump “directed” him to pay hush money to Stormy Daniels and another woman during the 2016 campaign, it is certain the president broke campaign-finance laws.

Leaving aside that the deal proves nothing about Trump, the fact remains that Davis’ role is a delicious revenge scenario beyond anything Hillary could have imagined. She now has a mole working with Mueller!

But there is also rich irony because extramarital sex is at the heart of Trump’s trouble, as it was with her husband’s two decades ago. Is she going to flip her script and insist now that sex is grounds for impeachment?

As for Cohen, he once vowed to “take a bullet” for Trump but switched teams in early July, when he hired Davis. At the time, it seemed an unlikely pairing, but it’s now obvious they came together because they share the goal of ending Trump’s presidency.

Davis made that crystal clear with a torrent of tweets and media appearances following Cohen’s plea deal. The first tweet said, “This is Michael fulfilling his promise made on July 2nd to put his family and country first and tell the truth about Donald Trump.”

He quickly followed by saying that if his client’s actions in the hush-money payments are “a crime for Michael Cohen, then why wouldn’t they be a crime for Donald Trump?”

In interviews, Davis sometimes contradicts himself, but consistently suggests his client has other evidence that Trump broke laws, including an episode involving computer hacking. Asked about a possible presidential pardon, ­Davis told NPR, “I know that Mr. Cohen would never accept a pardon from a man that he considers to be both corrupt and a dangerous person in the Oval Office.”

Cohen, his lawyer said, “is not interested in being dirtied by a pardon from such a man.”

Presto! And just like that, Cohen becomes Mr. Clean and a Never-Trumper.

In response, Trump lashed out at his former friend, but saved his most bitter barbs for Attorney General Jeff Sessions. He again expressed fury that Sessions recused himself from the Russia-collusion probe, setting the stage for Mueller’s appointment and everything that has followed.

Trump also battered Sessions over the one-sided nature of the investigation, citing Clinton’s deleted emails, Comey’s leaks, conflicts of interest involving Mueller, FISA court abuses and the Christopher Steele dossier as among the things that should be probed.

The president concluded: “Open up the papers & documents without redaction? Come on Jeff, you can do it, the country is waiting!”

Trump, of course, created the problems with his actions and shifting answers about the hush payments. And his choice to hire Sessions remains the biggest personnel mistake of his presidency. (Hiring Omarosa was dumber, but less consequential.)

Yet, for all the glee of his opponents and media doomsaying, only a fool would count the president out. He’s bounced back from the brink before and there are three reasons why he could do it again.

First, it will take something more serious than alleged campaign-finance violations to overturn an election through impeachment. The two-thirds majority vote required for conviction in the Senate was designed to be a stumbling block to factions and passions, and it saved Clinton during the Lewinsky scandal.

It’s also worth remembering that Clinton’s misconduct occurred in the White House, while the Trump allegations involve events before he became president.

Second, Trump can cure the injustice stemming from the one-sided probe by declassifying documents the Justice Department is hiding from Congress and the public. Everything he wants Sessions to release could become public with the president’s signature.

I have called this power Trump’s ace in the hole because revealing the dirty details of how insiders tried to steal the election could bolster his support. His refusal to play that card is bewildering.

Trump’s third reason for optimism is the possibility that predictions of a blue wave in the midterms will be as far off the mark as many 2016 polls were. Then he had his America First promises, and now he has major successes, especially the jobs boom.

His record, combined with the sense that he is under siege by a corrupt deep state, could motivate his half of the electorate to show up in full force on Election Day and save his neck once again.

To that end, the president plans to campaign for GOP candidates as many as four days a week and already has proven that his support can make a difference in tight races.

Given all the moving parts, and the likelihood of surprises, it is impossible to predict with strong confidence where the nation will be at the end of 2018.

All I know is that the coming months are going to be one ­helluva nasty ride. Here’s hoping people of good will on both sides remember that, in the end, we’re all still Americans.