When the White House backed off its efforts to dump Sebastian Gorka on another federal agency, the controversial counterterrorism advisor had the president himself to thank, The Daily Beast has learned.

After news emerged last week that the Trump administration was setting the stage to move the British-born national security aide out of the White House, President Donald Trump and his chief strategist Stephen Bannon “personally intervened” to put a halt to Gorka’s White House eviction, two senior administration sources said.

Last Friday, The Daily Beast broke the news that the Trump administration had been actively exploring options to remove Gorka from the West Wing, where he serves as “deputy assistant” to the president, and place him at another federal agency. News of Gorka’s looming departure from the White House came amid security clearance issues and a mounting controversy over his involvement with a far-right Hungarian group notorious for its collaboration with the Nazi regime during the World War II. Gorka also holds fringe, clash-of-civilization views that many have criticized as anti-Muslim and extreme.

Senior administration sources described the situation to The Daily Beast last week as “a pain in the ass,” and said that Gorka—“biding his time” on the federal payroll—had virtually zero substantive duties at the White House or role in its decision-making or national-security policy decisions.

However, Gorka owes his continued presence in the White House to President Trump himself, who views him as a robust communicator of the administration’s anti-terrorism, anti-ISIS policies, particularly on conservative radio and TV interviews.

Gorka and Bannon are close. They worked together at Breitbart News—the far-right Trump-boosting outlet that Bannon once ran as a “dictator,” according to former employees—where Gorka served as national security editor even as he was also a paid consultant for the Trump campaign.

As the White House explored alternative employment for Gorka, staffers there dropped hints to other agencies that he was in Trump’s good graces. According to a senior administration official, who described the comment as a subtle suggestion that Gorka should be given a post in the official’s office, the White House referred to Gorka in those interagency communications “a friend of the president.”

Following The Daily Beast’s initial report last week, rumors swirled that Gorka’s expulsion from the White House was mere moments away. That’s when Bannon stepped in.

“[Bannon] put a stop to it—he’s loyal and a friend’s job was in danger and reputation was getting dragged through the mud,” another Trump administration official said, noting that Bannon had acted “decisively” to lobby for one of his ideological and personal allies in the West Wing. Trump then privately assured Gorka that his job was safe for now.

It was at this point that interagency chatter regarding moving Gorka out of the White House abruptly ceased.

According to multiple administration sources, a White House faction led by Jared Kushner, Trump’s son-in-law and senior adviser, isn’t pleased with this development. Kushner, who warred with Team Bannon last month, also co-founded with Bannon the Strategic Initiatives Group, an informal think tank within the White House. Though Gorka was a member of the group, one White House source says Kushner now views him as a “clown” and wants nothing to do with him.

Still, Gorka is sitting pretty this week.

He told a reporter with Ami Magazine that he had personally met with Trump in the wake of reports of his impending departure, according to a since-deleted tweet from the Jewish publication. The president, Gorka said, assured him that “he’s not being asked to step down.”

But he did not shut the door on a White House departure. “I will be in the White House as long as the president wants me there, and if he needs me to do something somewhere else, I will do whatever he needs me to do,” Gorka told Fox News Radio.

The White House also seemed to leave the door open to a future move. Asked about reports of Gorka’s ouster on Monday, press secretary Sean Spicer said he had “no personnel announcement at the time. I have no belief that he is currently leaving the White House.”

The initial pressure to place Gorka at another agency riled some administration officials who viewed him as a liability—no matter where he was. One official at an agency to which the White House had shopped Gorka saw it as an attempt to offload a staffer with few official duties and mounting public relations baggage without having to upset the president and Gorka’s other White House allies.

For now, Trump’s affinity for Gorka and his ability to communicate administration policy on national security matters means he is staying put, even if his official duties remain sparse.

“The president really likes him and appreciates him as a good spokesperson for the administration, but he isn’t part of the [National Security Council] policy making process,” a senior administration official said of Gorka last month, adding that his contributions to foreign policy have been minimal, with National Security Adviser Lt. Gen. H.R. McMaster’s team overshadowing the relevance of his input. Officials spoke on condition of anonymity to discuss sensitive personnel matters.

Gorka ignored questions about his future employment plans after a speech to the Republican National Lawyers Association’s annual policy conference in Washington on Friday morning. He rushed to the elevator as New York attorney and RNLA vice-chair Larry Levy tried to keep a physical barrier between Gorka and a Daily Beast reporter.

“We’re not taking press questions at this time,” Levy said as he attempted to block a hallway at the National Press Club.

Gorka simply asked The Daily Beast on Friday morning if we had emailed the White House press shop. He had previously asked that questions be put in an email to him directly. He hasn’t responded to multiple requests for comment since.