John Bolton's ouster as national security adviser may be because of leaks.

Bolton was leaking to the press information about a planned Camp David meeting with Taliban leaders that made President Trump look bad, sources told CNN.

Although a rift between Trump and the hawkish Bolton had been growing for months, one source said “the leaking is what got him."

Trump tweeted Saturday that he was scrapping the Camp David meeting, set days before the 18th anniversary of the 9/11 attacks. He then declared negotiations over an American withdrawal from Afghanistan “dead."

Trump announced on Tuesday, via Twitter, that Bolton submitted his letter of resignation after he asked for it. "I informed John Bolton last night that his services are no longer needed at the White House. I disagreed strongly with many of his suggestions, as did others in the Administration, and therefore I asked John for his resignation, which was given to me this morning," Trump said.

Bolton has been national security adviser for roughly a year and a half. He was brought in to replace retired Army Lt. Gen. H.R. McMaster, who had a hard time cracking down on leaks in the White House. In September 2017, McMaster issued a memo on stopping leaks, but in an ironic twist even that document was leaked.