The former head of the National Security Agency instructed personnel not to get into a "tit for tat" with President Donald Trump and the media after he accused the intelligence community in a tweetstorm last year of leaking information to the New York Times, according to records obtained by BuzzFeed News.

“We will not get sucked into this,” Adm. Mike Rogers wrote in a Feb. 15, 2017, email to NSA officials in response to a briefing on the tweets. “Everyone needs to do their job and do in our normal professional and forthright manner. Our behavior will be driven by the standards of our profession and not the comments or views of others. No tit for tat pettiness from anyone at the NSA on this.

“We do not condone the leaking of classified or sensitive information and anyone at NSA determined to be behaving in such a manner will be held accountable and I don’t care about their rank or position.”

BuzzFeed News obtained Rogers’ emails in response to a Freedom of Information Act lawsuit.

The explosive report published by the New York Times was based on intercepted calls and phone records US officials shared with the newspaper. Such intelligence would be considered highly classified and compartmentalized.

According to the Times report, “The intercepts alarmed American intelligence and law enforcement agencies, in part because of the amount of contact that was occurring while Mr. Trump was speaking glowingly about the Russian president, Vladimir V. Putin. At one point last summer, Mr. Trump said at a campaign event that he hoped Russian intelligence services had stolen Hillary Clinton’s emails and would make them public.”

Hours after the story was published, Trump took to Twitter and railed against the “failing @nytimes and @washingtonpost” and blamed the NSA and FBI for the “illegal” leaks.