WASHINGTON (Reuters) - White House Chief of Staff John Kelly will leave his job at the end of the year, U.S. President Donald Trump said on Saturday, his latest staff shakeup since midterm elections a month ago cost Republicans control of the House of Representatives.

Trump, speaking to reporters as he left the White House to attend the annual football game between the Army and Navy military academies in Philadelphia, said he would name a successor for Kelly, possibly on an interim basis, in the next day or two.

“He’s a great guy,” Trump said of Kelly, who led the Department of Homeland Security before taking over as Trump’s chief of staff. “I appreciate his service very much.”

Trump has been in discussions for months with Nick Ayers, a top aide to Vice President Mike Pence, about becoming his chief of staff, a White House official told Reuters.

The president wants Ayers to do the job for two years, but Ayers is unable to make the commitment because of his family, including two young children, and has agreed to serve only until the spring of 2019, the official said.

“The president and Nick are still working on the specific terms of him taking over,” said the official, adding that Ayers was eyeing a return to Georgia and had been planning to leave Pence’s office and the White House this month.

Ayers has advised a number of high profile Republican governors and would bring a political edge to the president’s inner circle that was not integral to Kelly’s background.

A freewheeling former businessman, Trump brought Kelly in last year to restore order to his often chaotic White House, but has clashed repeatedly with the retired Marine Corps general in recent months. The two men were no longer on speaking terms, according to one source with direct knowledge of the situation.

Paul Ryan, the Republican leader in the House of Representatives, said Kelly was leaving what is “often a thankless job.”

Kelly’s impending departure is part of a broad overhaul designed to recalibrate Trump’s administration as it faces a new reality in Washington, with Democrats set to take control of the House in January and the 2020 presidential race gearing up next year.

On Friday, Trump announced his choice of William Barr, who was attorney general under former President George H.W. Bush in the 1990s, to return to the job as the head of the Justice Department.

He also picked Heather Nauert, spokeswoman at the State Department and a former Fox News presenter, to become U.S. ambassador to the United Nations.

Kelly, 68, had some success in restoring order to Trump’s White House after he was appointed in July 2017, but the president bristled at his style.

Slideshow ( 6 images )

Their rocky relationship was highlighted in “Fear: Trump in the White House,” a book by Washington Post reporter Bob Woodward that was released in September.

In it, Kelly was shown as one of several White House figures questioning Trump’s abilities and was quoted as calling the president “unhinged” and “an idiot.”

“It’s pointless to try to convince him of anything,” the book quoted Kelly as saying during a meeting. “He’s gone off the rails. We’re in Crazytown. I don’t even know why any of us are here. This is the worst job I’ve ever had.”

Slideshow ( 6 images )

Kelly later denied calling Trump an idiot and said the book was “another pathetic attempt to smear” Trump’s administration.

He issued a similar denial in April after NBC News reported he had referred to Trump as an idiot on multiple occasions and said the president did not understand policy or how the government works.

Trump made Kelly chief of staff after the departure of Reince Priebus, who lasted little more than six months in the job.

As head of Homeland Security, Kelly backed Trump’s ban on travel from certain predominantly Muslim nations but at times appeared at odds with the president’s agenda.

In January, he told Fox News that Trump was not “fully informed” when he made his signature promise to build a wall on the U.S. border with Mexico to block illegal immigrants and drug smugglers.

In other controversial comments, Kelly said in February that some young illegal immigrants dubbed “Dreamers,” brought to the United States as children, may not have signed up for a program to protect them from deportation because they are “too lazy to get off their asses.”

Kelly, who was born and raised in Boston, also sparked a backlash in October by saying the U.S. Civil War, in which Southern states rebelled to try to maintain slavery, was caused by a lack of “compromise.”

Unlike other key Cabinet appointments, the White House chief of staff does not require confirmation by the U.S. Senate.