President Donald Trump announced his nomination of General Mark Milley for the chairmen of the Joint Chiefs of Staff on Saturday.

The decision was in contrast to Defense Secretary Jim Mattis' preference for the role and could compromise Trump's relationship with the military head.

Trump and Mattis have appeared to be at odds in recent months, most recently with the president describing Mattis as out of place and saying last month he "may leave" the administration.

President Donald Trump announced his nomination of General Mark Milley for the chairmen of the Joint Chiefs of Staff, the country's top military post, on Saturday.

The decision regarding the nation's top military position was in contrast to the candidate Defense Secretary Jim Mattis reportedly preferred for the role and could compromise Trump's relationship with the defense head.

The Washington Post reported that Trump was deciding between Milley and the Air Force chief of staff, Gen. David Goldfein, whom Mattis preferred.

Though it was reportedly unclear why Mattis preferred Goldfein, Trump's decision could be taken as a sign of the two's weakened relationship, going against the member of his cabinet who oversees the military. "It's a pretty big decision to go against Mattis," a former top defense official told the Post.

Despite his reported preference, current and former officials told the Post Mattis and Milley have a good relationship, going back to the war in Afghanistan, for which Mattis sought Milley out to brainstorm.

Milley was widely reported to be nominee ahead of the Saturday announcement. Trump teased the decision Friday amid personnel changes in the State Department and Attorney General.

Trump has described Mattis as out of place in the administration, saying in a CBS "60 Minutes" interview that Mattis is "sort of a Democrat" and that "he may leave" after months of speculation on the former Marine Corps General's standing.

Read more: Trump says Mattis is 'sort of a Democrat' and that the defense secretary 'may leave' the administration

The president's comments came after he and Mattis have reportedly been at odds in recent months, as Trump last month overrode Mattis to order American troops to the southern border in preparation for the arrival of caravans of Central American migrants.

Mattis made a number of public statements on the troops at the border, but stayed away from using the same harsh terms as Trump, who called the caravans an "invasion."

Upon the White House's initial request for troops, Mattis personally rejected on the basis they were "inappropriate and legally treacherous," according to the New York Times,

Previous clashes between the two include Mattis' faltering position on Trump's Space Force and Trump seeming to blindside Mattis on a decision to announce on Twitter he was reversing an Obama-era decision to allow transgender troops to serve openly in the US military.