Donald Trump and John Kelly, the retired Marine whom he fired as White House chief of staff, have finally gone to war.

"When I terminated John Kelly, which I couldn't do fast enough, he knew full well that he was way over his head. Being Chief of Staff just wasn't for him. He came in with a bang, went out with a whimper, but like so many X's, he misses the action & just can't keep his mouth shut," Mr Trump tweeted on Thursday, making clear he demands and expects silence from aides whom he sometimes presses to sign non-disclosure agreements.

The president also claimed in a second tweet that Mr Kelly has a "military and legal obligation" to remain quiet about his time in the West Wing and his views about Mr Trump. Only that Mr Kelly has never mentioned signing a non-disclosure pact and was not an active-duty Marine when he worked in the administration.

Mr Trump then got personal, writing about the former chief of staff's spouse.

"His incredible wife, Karen, who I have a lot of respect for, once pulled me aside & said strongly that 'John respects you greatly. When we are no longer here, he will only speak well of you.' Wrong!"

The president's tweet came after Kelly on Wednesday night offered his most blunt and candid comments since being ousted about his former boss. Mr Kelly described Mr Trump as naive about North Korea and tried to distance himself from the president's hardline immigration policies.

The duo had a rocky relationship after Mr Trump plucked his first Homeland Security secretary out of his Cabinet and installed him in the chief's suite just a few steps from the Oval Office. Ultimately, the commander in chief and retired four-star general butted heads more often than not.

So Mr Kelly was out, replaced on an acting basis by Mr Trump's budget director, former conservative South Carolina Congressman Mick Muvlaney. Fast forward a year, and now Mr Mulvaney is the subject of Washington scuttlebutt that the famously mercurial and tough-to-work-for Mr Trump has lost confidence in him and is looking for what would be his fourth West Wing chief in just over three years.

But as Mr Mulvaney continues to occupy the office Mr Kelly once did, he is watching what amounts to a cautionary tale unfold.

Mr Kelly used a Wednesday night appearance at a New Jersey college to call the president's ask that Ukraine's leader "do us a favor though" by investigating top Democrats after discussing an American military aid package "an illegal order" to the US national security apparatus.

He defended Army Lt Col Alexander Vindman, who testified during the House impeachment inquiry that Mr Trump's 25 July call with Ukraine's leader was inappropriate and alarming. "We teach them, 'Don't follow an illegal order. And if you're ever given one, you'll raise it to whoever gives it to you that this is an illegal order, and then tell your boss,'" he said.

Mr Kelly also was critical of Mr Trump believing he could strike a deal with North Korean leader Kim Jong Un that would really lead to the dictator giving up his nucleae weapons.

"He will never give his nuclear weapons up," Mr Kelly said of Mr Kim. "Again, President Trump tried -- that's one way to put it. But it didn't work.

"I'm an optimist most of the time, but I'm also a realist," he said. "And I never did think Kim would do anything other than play us for a while, and he did that fairly effectively."

As Mr Mulvaney gets a fresh glimpse of life on the outside of Mr Trump's orbit, one of his subordinates, Press Secretary Stephanie Grisham, was the first member of team Trump to fire back.