WASHINGTON — President Donald Trump pushed aside his acting director of national intelligence, Joseph Maguire, in anger over what he perceived to be an inappropriate Congressional briefing by the top intelligence official in charge of election security, a former senior U.S. official familiar with the matter confirmed to NBC News

Trump's anger cost Maguire a chance to become the permanent DNI, the former official said, confirming a report in The Washington Post.

Trump announced Wednesday he was replacing Maguire with, Richard Grenell, the U.S. ambassador to Germany, a highly partisan figure with no intelligence experience.

That was a shift — previously, Maguire, who had served as acting director of national intelligence since August, had been under consideration to get the permanent job of DNI.

But last Thursday, the Post reported, Shelby Pierson, the intelligence official in charge of election security, gave a classified briefing to the House Intelligence Committee on 2020 election security.

Citing sources familiar with the matter, The Post reported that Trump "erupted" in the Oval Office the day after the meeting over what he perceived as disloyalty by Pierson.

The former official did not know what Pierson, who works for Maguire, said that set Trump off. The Post reported that the president "erroneously believed that she had given information exclusively to Rep. Adam B. Schiff, D-Calif., the committee chairman, and that the information would be helpful to Democrats if it were released publicly, the people familiar with the matter said."

A committee official told the Post that wasn't true. The committee did not immediately respond to a request for comment.

Pierson, a veteran intelligence official, is coordinating the intelligence gathering — and response — to foreign election threats.

While the U.S. government is working to secure the 2020 election from hackers and disinformation, President Trump has avoided publicly commenting or holding meetings about the subject because he believes the issue reflects badly on his 2016 victory in an election beset by Russian interference, officials have told NBC News.