President Trump’s decision to withdraw roughly 7,000 troops from Afghanistan, along with the resignation of his defense secretary, Jim Mattis, stirred fears in the Asia-Pacific region on Friday that the United States was abandoning its leadership of decades-old alliances crucial to stability and peace since World War II.

The surprise announcements came after President Trump said he was pulling American forces out of Syria, a decision that prompted Mr. Mattis to resign with a statement about the need to “treat allies with respect and also being clear eyed” about potential enemies.

In Afghanistan, Mr. Mattis was seen as the reliable conduit to the American government, and someone who provided balance to the whims of an often unpredictable president.

But the developments drew particular alarm in Australia, a close American ally whose soldiers have died in American-led wars in Vietnam, Korea, Iraq and Afghanistan.