From the moment Donald Trump secured the Republican nomination and then the presidency, national security officials under President Obama have shown themselves to be intense adversaries in public and behind the scenes.

In the latest development, special counsel Robert Mueller’s top-gun prosecutor, Andrew Weissmann, praised acting Attorney General Sally Yates, a Trump nemesis, for refusing a White House order to defend the president’s travel ban on Muslim-majority countries, according to internal emails.

Mr. Weissmann made it clear whose side he was on.

“I am so proud,” Mr. Weissmann wrote to Ms. Yates when he was the head of the Obama Justice Department’s criminal fraud division. “And in awe. Thank you so much. All my deepest respect.”

The U.S. Supreme Court this week approved Mr. Trump’s travel ban of targeted nations in a 7-2 ruling.

Mr. Weissmann, who as a private lawyer donated to Mr. Obama and to New York Gov. Andrew Cuomo, another Democrat, now is Mr. Mueller’s right-hand man. He oversaw the investigation of former Trump campaign manager Paul Manafort, including a pre-dawn FBI raid on his condo and an in-bed frisking of his wife.

The Weissmann emails and others from Obama political appointees praising Ms. Yates were unearthed in a Freedom of Information Act request by the conservative government watchdog Judicial Watch.

Mr. Trump fired Ms. Yates as she became a hero to Mr. Weissmann and other liberals.

The anti-Trump moves by Obama aides began in July 2016 during his campaign for the presidency.

Then-FBI Director James B. Comey began a criminal investigation of the Trump campaign, in whole or part, based on a dossier financed by the Democratic Party with an aim to destroy the Republican candidate. Its salacious and sometimes far-fetched scenarios of RussiaTrump collusion on the Russian hack of Democratic Party computers have not been confirmed publicly.

The top FBI investigator at that time was a “never Trump” advocate whom Mr. Mueller removed from his team last summer, The New York Times reported.

John O. Brennan, Mr. Obama’s CIA director and former campaign adviser, pushed the investigation during the campaign. He supplied Mr. Comey with the names of Russians with whom Trump associates had made any type of contact. Mr. Brennan testified to Congress that he provided the list of referrals without knowing what was discussed.

James R. Clapper, Mr. Obama’s director of national intelligence, has suggested that Mr. Trump is on the way out and calls him unfit for office.

“I really question his … fitness to be in this office,” Mr. Clapper told CNN after a fiery Trump speech in August. “And I also am beginning to wonder about his motivation for it. Maybe he is looking for a way out.”

Conservatives suspect all this has happened as Obama administration holdovers and former aides were working to sabotage the Trump administration.

‘A stealth coup’