US President Donald Trump has announced he fired his hard-line national security adviser, John Bolton, saying he disagreed "strongly" with him.
"I asked John for his resignation, which was given to me this morning," Mr Trump tweeted, adding he would appoint a replacement next week.
But Mr Bolton insisted he had quit and vowed to have his say "in due course".
He had disagreed with the president on a number of foreign policy challenges, from Afghanistan to Iran.
Allow Twitter content?
Mr Bolton, who had served since April 2018, was Mr Trump's third national security adviser after Michael Flynn and HR McMaster.
What is Bolton saying?
Moments after Mr Trump's tweet, Mr Bolton took to Twitter to offer a different version of events.
He maintained he had actually offered his resignation but Mr Trump told him, "Let's talk about it tomorrow."
Allow Twitter content?
As the news broke, Mr Bolton texted a Fox News host live on TV to insist he had resigned as national security adviser.
He also texted Washington Post reporter Robert Costa to say, "I will have my say in due course" and "My sole concern is US national security".
The dismissal came as a surprise. Just two hours before his departure was announced, Mr Bolton had been due to host a White House briefing with Secretary of State Mike Pompeo and Treasury Secretary Steven Mnuchin.
The new acting national security adviser will be Charles Kupperman, who was a deputy to Mr Bolton, the White House told the BBC.
What are White House sources saying?
Sources said the National Security Council, which advises the president, had become a separate entity within the White House under Mr Bolton.
A former senior Trump administration official, who wished to remain anonymous, told the BBC: "He [Bolton] operates separately from the rest of the White House."
According to the official, Mr Bolton did not attend meetings and followed his own initiatives.
A White House official told the BBC's US partner, CBS News, "Bolton has his priorities. He didn't ask the president 'What are your priorities?' They're Bolton's priorities."
A former senior administration official told CBS Mr Bolton's "his way or the highway" approach had infuriated many people inside the White House, including the president.
In the lead-up to Mr Bolton's firing, Mr Trump reportedly approached his predecessor, HR McMaster, NBC News reports.
The president told the retired general he missed him and asked his advice on national security issues, two anonymous sources familiar with the conversations told NBC.
An untenable situation
John Bolton was always an unusual fit in the Trump White House. While he was an animated personality on Fox News - clearly endearing him to the president - he was also an outspoken foreign policy hawk working for a man who campaigned against international adventurism.
Mr Bolton was a strong supporter of the Iraq War, for instance, while the president has called the conflict one of the greatest US military blunders.
On topics like North Korea and Russia, the president's conciliatory position when Mr Bolton arrived in April 2018 was clear - and clearly contrary to the long-time foreign policy hand. Add disagreements on Afghanistan negotiations and Iran confrontation, and it created an untenable situation.
Mr Trump's third national security adviser in as many years has been on the outs for some time. He did not join the president at a key meeting with Kim Jong-un, and phoned in his objections to a Camp David event with the Taliban while in Poland last week.
There appears to be disagreement over whether Mr Bolton was fired or resigned. One way or another, a change was coming - even if just yesterday, Mr Trump had tweeted that reports of "turmoil in the White House" were created by the "Dishonest Media".
How did Trump and Bolton disagree?
Mr Bolton, a leading foreign policy hawk, was the chief architect of Mr Trump's hard-line stance on Iran.
He had reportedly opposed the president's recent suggestion that he was willing to talk to Tehran's leaders.
The former national security adviser had also advocated for a much tougher stance on North Korea, Russia and Afghanistan.
Mr Bolton was blamed by US officials for the collapse of a summit in February between Mr Trump and North Korean leader Kim Jong-un in Vietnam by putting forward a list of uncompromising demands that Pyongyang rejected.
Mr Bolton opposed peace talks with the Taliban, which Mr Trump scrapped at the weekend after inviting the group to the US.
According to Foreign Policy magazine, Mr Bolton had argued that inviting a US-designated terror group to Camp David - the presidential retreat outside Washington - would "set a terrible precedent".
Mr Bolton had a reputation as a warmonger, and Mr Trump once reportedly joked in an Oval Office meeting that "John has never seen a war he doesn't like".
Earlier this year, Mr Trump was reportedly angry with the failure of US policy in Venezuela, complaining that Mr Bolton had misled him about how easy it would be to replace President Nicolás Maduro, who has clung to power.