On Friday, the curtain fell on the UN general assembly in New York. Attended by many of the world’s leaders, the gathering addressed delegates in high-level general debates on how best to improve our world. One debate was entitled: “Making the UN relevant to all people: global leadership and shared responsibilities for peaceful, equitable and sustainable societies.”

Months earlier, an incident germane to this theme played out in northern Thailand, where members of the Wild Boars football team became trapped in a cave. It is a story that demonstrated nations united and responsibilities shared in the face of adversity and incredible odds; an instructive lesson in the power of unity, a quality we often take for granted despite its important contribution to peaceful, equitable and sustainable societies.

Barely a sliver of humanity had heard about the team – a clutch of boys aged between 11 and 16 – before June of this year, when their coach led them into the Tham Luang cave complex on a team-building exercise that went terribly wrong.

They became trapped amid rising flood waters, forcing them to survive without food for nearly a week. Their dramatic, week-long rescue gripped millions of people around the world and was dubbed by many as a miracle. But what made it possible? The actions of many. Under the leadership of the Thai government, divers, police, army, navy and airforce came together with hundreds of volunteers and experts from countries across the globe to conduct the rescue.

A diver from the tiny neighbouring nation of Laos was one of the first to help and stayed engaged in the rescue effort every single day.

There were daily stories that spoke of responsibilities shared in an effort to save the boys. The determination of so many to ensure that no one was left behind was staggering.

“Leave no one behind” is the key message of the UN as it tries to bring prosperity to people worldwide through the sustainable development goals. The same message became the enduring theme of the cave boys rescue operation.

From news reports, we now know that the 25-year-old coach – despite a huge error in judgement – cared steadfastly for the boys. He counselled them, shared his food, and practised meditation with them to keep their spirits strong. He wanted to ensure their safety; he wanted to leave no one behind.

Outside the cave, international divers joined forces with Thailand’s elite teams, plotting strategies and working in the face of tremendous odds. They too wanted to leave no one behind but, in the process, sadly lost one of their own.

This force of unity for a team of boys from marginalised communities is testimony to what we can do when we collaborate. Some of the boys were not Thai citizens, but now the Thai government is providing them with citizenship.

The Wild Boars team provided us with an abiding lesson in the power of shared responsibility. As their story shows, there is no stronger force to bring about a better world. If we can harness this unity for the sustainable development agenda, we will have peaceful, equitable and sustainable societies, and no one will be left behind.

• Haoliang Xu is UN assistant secretary general and director of the UN Development Programme’s regional bureau for Asia and the Pacific