President Trump shakes hands with national security adviser H.R. McMaster in February. (© Kevin Lamarque/Reuters)

The recent removal, and reinstatement, of the National Security Council’s senior intelligence director is a telling illustration of the ongoing animosity between at least some sectors of the Trump White House and the CIA and may be an early sign of problems for new national security adviser H.R. McMaster.

On Friday, McMaster told Ezra Cohen-Watnick, a 30-year-old former Defense Intelligence Agency operative brought on board by ­McMaster’s ousted predecessor, Michael Flynn, that he was being moved to another job from his position as senior NSC director for intelligence programs.

McMaster had been told by CIA Director Mike Pompeo that some intelligence officials had problems with Cohen-Watnick and didn’t think he was up to the job, according to U.S. officials familiar with the matter. The intelligence director provides White House interface with the intelligence community and is a filter for information to the president.

Cohen-Watnick, who worked on the Trump transition and is close to Jared Kushner, a top adviser and President Trump’s son-in-law, immediately consulted Kushner and Stephen K. Bannon, Trump’s chief White House strategist. The two subsequently spoke with Trump, and by Sunday, ­Cohen-Watnick was back in place.

The sequence of events, first reported by Politico, appeared to contradict public pledges made by the White House that McMaster would have full leeway to choose his own staff.

Chief of Staff Reince Priebus said in mid-February that Trump had made clear, after the first choice to replace Flynn had turned down Trump’s offer in part because of staffing issues, “that the new director will have total and complete say over the makeup of the NSC and all of the components of the NSC.”

That status quickly led to the departure of David Cattler, another Flynn protege, who McMaster determined was in a job that was superfluous as coordinator of the NSC’s regional directorates. By all accounts, that decision was not controversial.

Asked about the flap over ­Cohen-Watnick, spokesmen for both the CIA and the NSC declined to discuss it but said the two institutions were getting along fine.

“CIA is focused solely on providing the President and other policymakers with the best intelligence possible to protect the nation against adversaries,” CIA Public Affairs Director Dean Boyd said in an email. “That’s a full-time job. We’re working quite well with the National Security Council on a range of issues confronting the nation and foresee no change in this collaborative relationship.”

NSC spokesman Michael Anton said the agency’s professional briefers “do a phenomenal job; their work is not only necessary, it’s essential. I’ve been in many meetings with Director Pompeo and others in which they interact with senior White House officials. . . . They’re very professional, and their work is deeply appreciated.”

But supporters of Cohen-Watnick, among several people who discussed the issue on the condition of anonymity to talk about intelligence and personnel, say the CIA resents him for several reasons. He is young, brash and ambitious. He worked for the Defense Intelligence Agency in a job that the CIA sees as its rightful possession, and he has shown more affinity for the FBI and its counterintelligence operations against spies at home than for the CIA’s counterterrorism tasks overseas.

As part of his duties, Cohen-Watnick has briefed Trump, Kushner, Bannon and others, and he is seen as loyal to Trump and his agenda. In possession of a high-level security clearance from his Defense Intelligence Agency days, Cohen-Watnick was one of the few incoming officials who could attend intelligence briefings early in the transition.

Trump frequently vilified the CIA during the transition, accusing intelligence officials of conducting a Nazi-like campaign to smear him and rejecting its assessment that Russia hacked Democratic Party emails to disrupt the electoral process and benefit his campaign against Democratic presidential nominee Hillary Clinton. When he visited the agency on his first full day in office, in an apparent attempt at fence-mending, many agency officials were put off by what they saw as a self-aggrandizing, disrespectful speech delivered in front of a wall of stars representing those who had lost their lives in the intelligence service.

Denying that he had ever criticized the agency, Trump blamed it all on the media and told intelligence officers that “there is nobody that feels stronger about the intelligence community and the CIA than Donald Trump.”

Overall, the high institutional tensions between Trump and the CIA seem to have died down since the tumultuous transition and early days of the administration.

But on some issues, uneasiness remains on both sides. Chief among them is Iran, where the intelligence community and some within the NSC have sharply different opinions on reality and how to drive policy. Cohen-Watnick is seen as among those who say that upheaval and possibly even regime change should be the goal.

This group of influential Iran hawks, organized within the NSC as a strategic assessment cell, maintains that the United States has nine to 12 months to roll back Iranian influence inside Iraq or risk permanently losing influence there to Tehran.

“There’s definitely a perception in the White House among certain people — and I mean the National Security Council — that the ­counter-ISIS campaign was essentially making Iraq safe for Iran,” said one senior U.S. official, who said that view was not shared by Secretary of State Rex Tillerson or Defense Secretary Jim Mattis, and “I don’t think McMaster sees it that way. . . . What the President thinks, I can’t characterize.” ISIS is an acronym for the Islamic State.

“I think the people who have that view come by it honestly, so I don’t want to sound dismissive or disrespectful,” the official said. “But the longer you are in government, the more nuanced your view will become.”

Cohen-Watnick, said one official who has worked with him at the NSC, is “very big on how we can get more aggressive against Iran, and very dismissive that [Tehran] might escalate. . . . Ezra is really a big fan of covert-y action stuff.”

He and others have balked at CIA assessments that escalation is indeed the likely response to direct U.S. confrontation and that the best way to get results from Iran is through slow and steady economic and diplomatic pressure.

Greg Jaffe contributed to this report.