The Trump administration is looking for a replacement for Defense Secretary Jim Mattis, whom President Donald Trump criticized after Mattis resigned late last year.

At least two candidates have reportedly turned down the job, typically viewed as one of the most prestigious in the US government.

The way Trump has treated appointees may make any job in his administration unappealing.

Despite President Donald Trump's stated satisfaction with acting Defense Secretary Patrick Shanahan, the White House has reportedly stepped up its search for a replacement for Shanahan's predecessor, Jim Mattis, who resigned late last year.

According to a Politico report, retired Army Gen. Jack Keane recently turned down an offer to take the job — the second time Keane has done so.

Read more: Trump says 'the generals' asked for more time in Syria, but he said 'Nope' because 'We've knocked them silly'

In the weeks after Trump's election, Keane said he had been offered the position but declined.

"I have some personal issues surrounding the death of my wife recently, and I explained all that to Mr. Trump, and he was very gracious and understanding and quite supportive," Keane said at the time. (Keane retired from the Army in 2003 because his wife had Parkinson's disease, he said in 2014.)

Retired US Army Gen. Jack Keane. REUTERS/Rick Wilking

Mattis, a retired Marine general whom Keane recommended for the defense secretary job, left over numerous disagreements with Trump, including Trump's decision to pull US forces out of Syria; Trump has since changed his message from ordering an immediate withdrawal to one that could take four months.

Keane didn't comment to Politico on his decision to decline the job, but he has criticized Trump's Syria decision, calling it a "strategic mistake."

Read more: Trump bashes 'failed Generals' in a barrage of tweets on New Year's Eve

"Yes, I do disagree with it, and I've had the opportunity to tell him so," Keane said of Trump's decision when asked about it during a Fox News interview on December 21.

Jon Kyl, the former Republican senator from Arizona who helped shepherd Brett Kavanaugh through his Supreme Court confirmation, also declined the job, according to Politico.

David Petraeus, a retired general and former CIA director whom Keane also recommended for defense secretary in 2016, has also quashed rumors that he could take the job now, saying he "cannot envision returning to government at this time" and that he is "not sure" his views align with Trump's.

'It's a big, big hassle'

Then-Defense Secretary Jim Mattis with Trump at the White House in October. Win McNamee/Getty Images

The aversion of some experienced officials to working for Trump is part of a self-inflicted personnel problem for the administration, according to Peter Feaver, a Duke professor and expert on civil-military affairs.

Like in most Republican administrations, Trump's Defense Department has a mix of retired military officials and former business executives in civilian positions. But many civilian officials who would otherwise be there are missing.

Read more: Jim Mattis' brother says he had 'no anger' about being forced out by Trump

When asked about Trump's defense staff, Feaver said that "the dearth of regular civilian policy experts" was due in large part to many of those experts having rebuked Trump during his campaign.

In March 2016, 122 "members of the Republican national security community" signed a letter saying they were "united" in their "opposition to a Donald Trump presidency."

Trump and Hillary Clinton, the 2016 Democratic presidential nominee, at a debate in St. Louis on October 9, 2016. Getty

In August 2016, 50 Republican national-security officials, many of whom were senior officials in the George W. Bush administration, signed a letter saying Trump "lacks the character, values, and experience to be President" and "would put at risk our country's national security and well-being."

Many signatories of the August letter told The New York Times they declined to sign the March letter but changed their minds after Trump's attacks on NATO and his invitation to Russia to hack Hillary Clinton's email server.

Read more: Trump says it's 'insane' that watchdog reports about Afghanistan are released to the public: 'The public means the enemy'

In September 2016, 75 retired career foreign-service officers — among them ambassadors and senior State Department officials who served in both Republican and Democratic administrations — signed a letter saying Trump was "entirely unqualified to serve as President and Commander-in-Chief."

Some signees changed their minds in the weeks after Trump's election, but many remain on the outside despite numerous vacancies in the executive branch, particularly at the State Department.

The administration's rejection of "Never Trumpers" has been a hindrance, Feaver said.

A protester takes a selfie while demonstrating against Trump in New York City on April 14, 2016. Reuters/Mike Segar

At the outset, the administration was "putting in a lot of effort" into staff positions, Feaver said, "but they were hobbled by a very late start" and "by this self-imposed requirement" to keep out experts who had spurned Trump.

As a result, he added, the administration has "a very hard time finding the people of the caliber that they want."

The departure of Mattis — whom Trump had long derided and whose resignation Trump later said was "essentially" a firing — adds another hurdle.

Read more: The Coast Guard is about to go without pay because of the government shutdown, but its members are still out doing missions

"Now there's another problem: the very turbulent churn in personnel that is itself deterring other people from wanting to join," Feaver said.

"It's a big, big hassle" to take a government job, Feaver added, particularly for officials leaving lucrative private-sector jobs who could face scrutiny while being vetted for their new roles. The possibility that you could be fired or have your reputation tarnished by a presidential tweet or offhand remark is another disincentive.

"Who wants to be secretary of defense after they saw how Mattis was treated?" Feaver said.