Trump says chief of staff John Kelly will leave at the end of the year

Kelly has had a rocky relationship with the president over the past 17 months.

A replacement will be named, possibly on an interim basis, Trump told reporters Saturday on the South Lawn of the White House before departing for the Army- Navy football game.

"John Kelly will be leaving, I don’t know if I can say retiring. But he’s a great guy," Trump said, adding he would announce Kelly's replacement "over the next day or two."

The leading candidate to take over would be Nick Ayers, who currently serves as Vice President Mike Pence’s chief of staff, sources told ABC News.

The president, who has fired some of his closest advisors with a tweet, gave Kelly a more graceful exit with his South Lawn announcement, noting that Kelly has been with him in two different roles: DHS Secretary and Chief of Staff.

"I appreciate his service very much," Trump said.

Kelly’s departure, long-rumored around Washington, represents yet another dramatic shift in power dynamics and management style inside a notoriously tumultuous West Wing.

Just a few months ago, Trump had asked Kelly to stay on as chief of staff through his 2020 re-election campaign, and Kelly accepted, several White House officials confirmed to ABC News.

At a separate meeting with Cabinet-level communications staff at the time, a senior administration official said Kelly voiced his intention to stay on in the role for far longer -- through 2024 -- should the president be elected to a second term.

But the president, increasingly exerting direct control of West Wing operations, has marginalized Kelly's role and influence. Kelly has also chafed at the president's private disparagement of one of his closest allies and confidantes, Homeland Security Secretary Kirstjen Nielsen.

Ayers, 36, is seen by Trump and his closest allies as a loyalist and prominent advocate for the administration’s policies and political efforts. And Ayers’ role as the right-hand man to Pence over the past year has put him in close proximity to some of the moments of the Trump presidency.

Kelly departs after 17 months on the job. He was appointed by Trump to replace Reince Priebus in July 2017 in an effort to impose order, discipline and workflow on a chaotic inner circle that had grown unwieldy.

Insiders say his tenure will be remembered for stabilizing the ship and steering the presidency through historic times, from a summit with North Korea to contentious trade disputes with allies to legislative battles over health care and tax cuts.

While Kelly was lauded for streamlining operations, the president and some of his long-time aides have chafed at the restrictions Kelly imposed, including limits to Oval Office access, a crackdown on temporary security clearances and ban on personal cell phone use in the West Wing, sources told ABC News.