Mr. Gorka was a close associate of former White House chief strategist Steve Bannon, who was ousted last week.

Sebastian Gorka, a controversial adviser to US President Donald Trump known for his rightwing views, no longer works at the White House, an administration official said, amid conflicting claims about whether he quit or was fired.

“Sebastian Gorka did not resign, but I can confirm he no longer works at the White House,” a White House official said.

Mr. Gorka was a close associate of former White House chief strategist Steve Bannon, who was ousted last week.

His removal was one of the key demands of Democratic lawmakers led by Indian-American Pramila Jayapal, who has said Mr. Gorka represented the dangerous rightwing in the White House.

Some reports and Mr. Gorka’s supporters said he has resigned.

“Given recent events, it is clear to me that forces that do not support the MAGA [Make America Great Again] promise are — for now — ascendant within the White House,” Mr. Gorka wrote in his resignation letter, first reported by Federalist.

“As a result, the best and most effective way I can support you, Mr. President, is from outside the People’s House,” he wrote.

According to Federalist, Mr. Gorka’s letter expressed unhappiness with the direction the Trump administration’s foreign policy has taken, as signalled by the President’s recent speech on Afghanistan: “Regrettably, outside of yourself, the individuals who most embodied and represented the policies that will ‘Make America Great Again,’ have been internally countered, systematically removed, or undermined in recent months. This was made patently obvious as I read the text of your speech on Afghanistan this week...” he wrote.

“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...” he alleged.

“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,” Mr. Gorka said.

In recent weeks reports had emerged that he had ties with Nazism, an allegation that was strongly refuted by him.

“Your presidency will prove to be one of the most significant events in modern American politics. November the 8th was the result of decades during which the political and media elites felt that they knew better than the people who elect them into office. They do not, and the MAGA platform allowed their voices to be heard,” Mr. Gorka wrote.

“Millions of people believe in, and have chosen, you and your vision of Making America Great Again. They will help eventually rebalance this temporary reality,” he said.