President Trump on Wednesday named Richard Grenell, the U.S. ambassador to Germany, as the next acting director of national intelligence, placing a fiercely loyal ally atop an intelligence structure he has frequently railed against.

It is unclear whether Trump intends to nominate Grenell to fill the top intelligence post on a permanent basis, which would require Senate confirmation.

The appointment took many in Washington, including on Capitol Hill, by surprise.

Grenell, a former State Department official and communications executive, has been a Trump confidant and ad hoc adviser on issues beyond his ambassadorial work in Berlin.

He is a conservative foreign policy hawk and sometime media critic, as well as a vocal supporter of Trump on social media. He has sparked controversy in his diplomatic role, but also won praise in Germany and elsewhere for taking on issues such as gay rights in Eastern Europe and the long-running tensions between Kosovo and Serbia.

Grenell would be the first openly gay member of the Trump Cabinet. He did not respond to a request for comment.

Trump was being pushed by some in the intelligence community to nominate the current acting intelligence director, Joseph Maguire, to take the job permanently, but the president has been fixated on appointing people he believes are loyal to him, according to White House officials who, like others, spoke on the condition of anonymity to discuss internal deliberations.

In recent weeks, he has asked aides which employees are “bad” or “leakers” and deserve to be fired, aides said.

In a statement, Maguire said “it has been an honor to work alongside the men and women of the intelligence community” as acting director of national intelligence, and that he was “committed to leading [them] until Ambassador Grenell assumes the role.”

Maguire, who was scheduled to meet with White House officials Thursday afternoon, was blindsided by the news, said a person familiar with the matter, who spoke on the condition of anonymity to discuss a sensitive situation.

The New York Times first reported Grenell’s expected appointment.

Grenell’s loyalty to the president extends beyond his public statements. In 2018, internal documents from the Trump International Hotel in Washington listed Grenell as a “Gold” level member of the Trump Organization’s “Trump Card” loyalty program.

This is the second time that Trump has given a prominent post to a high-level Trump Card member. Kelly Craft, Trump’s ambassador to the United Nations, also had gold status, according to the 2018 documents — “VIP Arrivals” lists that the hotel used to alert employees to important guests. The lists were obtained by The Washington Post.

Grenell’s appointment is likely to exacerbate tensions between the president and members of the intelligence community, who have been frequent targets of Trump’s ire.

Current and former officials questioned Grenell’s qualifications to lead the intelligence agencies and said his loyalty to Trump appeared to be the reason for his appointment.

“Nothing in Grenell’s background suggests that he has the skill set or the experience to be an effective leader of the intelligence community,” said Nicholas J. Rasmussen, who was the director of the National Counterterrorism Center under Trump and President Barack Obama and who has known and worked with Maguire for over a decade.

“His chief attribute seems to be that President Trump views him as unfailingly loyal — hardly sufficient to make someone qualified to perform the duties of the DNI.”

Marc Polymeropoulos, a former senior CIA official, questioned why the White House had again chosen not to nominate a permanent intelligence director.

“How are both sides of the aisle not outraged by yet another ‘acting’ role?” he said. “We are in need of the DNI designate to provide his thoughts on the whistleblower statute, the intelligence community plan to thwart potential Russian interference in the 2020 elections, possible Iranian retaliation for the Qasem Soleimani strike and other key national security challenges.”

Grenell inspired controversy almost from the moment he became ambassador in 2018. In a tweet he posted hours after Trump said the United States would exit the Iran nuclear deal, Grenell wrote that “German companies doing business in Iran should wind down operations immediately.”

Germany and other key U.S. allies said they intended to remain in the agreement and the perceived ultimatum angered some officials in Berlin. Grenell has also focused on NATO and the shortfall in German defense spending, an issue Trump mentions frequently.

Grenell also drew criticism from diplomats and foreign officials for an interview with the right-wing Breitbart news site, in which he said he wanted to “empower” conservatives in Europe.

One U.S. official familiar with the decision said Grenell is expected to take up his new post quickly.

Anne Gearan, David A. Fahrenthold and Ellen Nakashima contributed to this report.