SEOUL, South Korea — Secretary of Defense Jim Mattis started Thursday morning ensconced in meetings with high-ranking Chinese military officials in Beijing, navigating a thin line between relationship-building and military posturing.

By the afternoon he was standing beside his South Korean counterpart in Seoul, reaffirming a commitment to one of the United States’ closest allies amid moves to halt North Korea’s nuclear ambitions.

The meetings come as military officials in Seoul and Washington wrestle how to follow this month’s talks in Singapore between the North Korean leader, Kim Jong-un, and President Trump. Hopes of an enduring peace between the two Koreas remain riddled with suspicion of Mr. Kim’s sincerity about dismantling a decades-old nuclear program that has long been a hallmark of his family’s dynasty.

During his brief visit to Seoul, the South’s capital, Mr. Mattis said that the United States would maintain current troop levels in South Korea and offered assurances that the two nations’ alliance was still “ironclad” despite the recent cancellation of a massive joint military exercise. That surprise concession came during the Trump-Kim talks and left future military training in limbo in the hopes of helping advance North Korea’s denuclearization.