SEOUL, South Korea — The abrupt resignation of Defense Secretary Jim Mattis injects new uncertainty at a critical time for the U.S.-South Korean alliance and nuclear talks with North Korea.

The apparent reason for his departure — President Donald Trump’s decision to withdraw U.S. troops from Syria and Afghanistan — also underscored an unpredictability of U.S. foreign policy that could extend to the divided peninsula.

Trump has said in the past that he wants to pull Americans from South Korea to save money despite the threat from the North. Critics said the abrupt pullout from Syria raised concern for allies in Seoul and elsewhere.

“It has rattled the world,” said Sen. Lindsey Graham, R-S.C., said as he called on Trump to reverse the decision. “You see North Korea flexing their muscle now: ‘Why don’t you leave South Korea before we do a deal?’ ”

Mattis, a retired Marine general who is widely respected in the South, planned to leave his post by the end of February, but Trump tweeted on Sunday that Mattis’ last day would be Jan. 1 and that deputy defense secretary Patrick Shanahan would take over in the interim.

Mattis' two years as defense chief included many disagreements with Trump.

The former four-star general didn’t spell out those issues in his two-page resignation letter that he hand-delivered to Trump on Thursday, but his decision was widely seen as a rejection of Trump’s “America First” foreign policy that has led to disputes with longtime allies.

His departure also will deprive officials in Seoul of somebody they considered a voice of reason in the Trump administration.

“It’s certainly going to cause concern, I think, in South Korea,” said Jenny Town, a Korea specialist at the Washington-based Stimson Center. “Mattis is one of the few people they looked to for direction and reason in an administration where it has been often difficult to decipher what our policy is and where our relationship is going.”

Mattis was seen as a steadying factor last year when Trump and North Korean leader Kim Jong Un traded threats of war as Pyongyang conducted a series of missile and nuclear tests before diplomatic efforts reversed tensions earlier this year.

“It’s hard to see where this goes until we have a better sense of who’s coming next, but it’s also hard to see that this move is going to improve relations both with our friends or our adversaries at this point,” Town said.

Town and others speculated that the president will choose a staunch supporter who won’t push back on defense issues.

“Mattis was always resolutely against any kind of military action in North Korea,” Town said, adding that appointing somebody who refuses to disagree with Trump raised the danger of allowing “callous and brash moves.”

Seoul and Washington insist their alliance, which has lasted since the 1950-53 Korean War ended in an armistice instead of a peace treaty, remains ironclad. But they have disagreed over the approach to North Korea as talks aimed at persuading it to give up nuclear weapons have stalled.

The two sides also have been unable to reach a new agreement on sharing the cost of stationing some 28,500 U.S. troops in the South. Trump has demanded that the South sharply increase its contribution.

The current contract is set to expire at the end of the year, although the sides said talks are ongoing.

Mattis resigned days after Trump announced he was pulling all U.S. troops out of Syria and ordered more than 7,000 withdrawn from Afghanistan. The decisions stunned allies and partners who are fighting with the Americans.

“My views on treating allies with respect and also being clear-eyed about both malign actors and strategic competitors are strongly held and informed by over four decades of immersion in these issues,” Mattis wrote. “We must do everything possible to advance an international order that is most conducive to our security, prosperity and values, and we are strengthened in this effort by the solidarity of our alliances.”

“Because you have the right to have a Secretary of Defense whose views are better aligned with yours on these and other subjects, I believe it is right for me to step down from my position,” he added.

The resignation highlights fears that the U.S. might be an undependable partner for allies, said Park Hwee Rhak, a professor of politics at South Korea’s Kookmin University.

“I think Trump’s decision to withdraw U.S. troops from Syria completely and swiftly has unnerved the U.S.-South Korean alliance,” he said. “It shows the U.S. won’t play the role of the world’s policeman despite a desire to do so from the president’s advisers, including the defense secretary.”

gamel.kim@stripes.com

Twitter: @kimgame