PYEONGCHANG, South Korea — The 23rd Winter Olympics came to a festive close on Sunday, with athletes from the two Koreas marching into the cold stadium together, but wearing different uniforms and waving the flags of their own countries.

Although some athletes also carried flags showing a unified peninsula, the fact that so many were carrying distinct national flags was a pungent sign that the truce between North and South Korea that had marked these Olympic Games might already be dissipating.

The 22 North Korean athletes — as well as the hundreds of cheerleaders and security minders who accompanied them — will now depart for home across the heavily fortified border that divides the two nations.

The geopolitical tensions that at times overshadowed the sporting events inevitably intruded on the closing ceremony, with Ivanka Trump, President Trump’s daughter and senior adviser, sitting in the stands close to Kim Yong-chol, a former spymaster from North Korea accused of overseeing a deadly attack on South Korea in 2010.