Sebastian Gorka, a controversial White House staffer who served as a fiery spokesman for President Trump on national security matters, abruptly left the administration on Friday as his nationalist faction was being silenced, four people briefed on Gorka’s exit confirmed.

Gorka, a deputy assistant to the president, is a close ally of former chief strategist Stephen K. Bannon, who departed the White House last week. Together they saw their roles as enabling and promoting the president’s combative populism and revolutionary impulses.

Although Trump enjoyed watching his cable television appearances, in which he performed like a pit bull and taunted many news anchors for peddling what he and the president deemed “fake news,” Gorka had run afoul of many of his colleagues, including some on the National Security Council who considered him a fringe figure.

Officials said it was widely known that White House chief of staff, John F. Kelly, who has been restructuring the West Wing to stem infighting and chaos within the staff, was eager for Gorka to depart the administration.

While Gorka publicly released a resignation letter expressing his displeasure with the changes that he felt left his faction silenced, two White House officials insisted Gorka did not resign but rather was forced out. A third White House official said the “writing was on the wall” that Kelly wanted Gorka to leave.

Gorka’s departure spells the end of the Bannon era inside the White House, though he indicated he intended to be a potent force outside the administration.

Gorka previously worked at Breitbart News alongside Bannon, who rejoined the conservative news organization last week as executive chairman vowing to wage war against anyone — including West Wing officials — who stand in the way of Trump’s nationalist agenda.

Gorka did not immediately respond to a request for comment on Friday evening. The Federalist, which first reported Gorka’s departure, published what it says was Gorka’s resignation letter to Trump. Someone close to Gorka confirmed the letter’s authenticity to The Washington Post.

It was unclear whether Gorka shared his letter with anyone besides The Federalist. One White House official said that Gorka spoke with Kelly on Friday to discuss his exit and asked to visit Trump in person on Monday to hand him a departure letter, but was not granted that permission.

“It is clear to me that forces that do not support the [Make America Great Again] promise are — for now — ascendant within the White House,” he wrote. “As a result, the best and most effective way I can support you, Mr. President, is from outside the People’s House.”

Gorka cited Trump’s speech Monday night announcing a new strategy for the war in Afghanistan.

“The fact that those who drafted and approved the speech removed any mention of Radical Islam or radical Islamic terrorism proves that a crucial element of your presidential campaign has been lost,” Gorka wrote.

He added, “Just as worrying, when discussing our future actions in the region, the speech listed operational objectives without ever defining the strategic victory conditions we are fighting for. This omission should seriously disturb any national security professional, and any American who is unsatisfied with the last 16 years of disastrous policy decisions which have led to thousands of Americans killed and trillions of taxpayer dollars spent in ways that have not brought security or victory.”

Born in England to Hungarian parents, Gorka, 46, is known for his hard-line stands on Islam and his past involvement in right-wing Hungarian politics.

He was recruited into the White House as a senior member of the Strategic Initiatives Group, an internal think tank that was to report to Bannon and Jared Kushner, the president’s son-in-law and senior adviser. But the group quickly disbanded, leaving Gorka without a clear portfolio.