A hotly contested, closely watched presidential election is won by a man whom political experts, media and many citizens expected to lose.

After his surprise victory, people pour into the streets. The victors are jubilant. The losing candidate’s supporters are upset. But they remain quiet, respecting the electoral result and continuing a tradition dating to the nation’s independence from Great Britain.

This was not the United States on Nov. 8. It was Ghana, a West African nation of 27 million people, on Dec. 7. There, supporters of defeated incumbent President John Dramani Mahama and supporters of the president-elect, former Foreign Minister Nana Addo Dankwa Akufo-Addo, took to the streets, arm-in-arm, celebrating a peaceful democratic election — something of a rarity in West Africa.

I was surprised by the vote’s outcome but not by Ghana’s response, because I spent last year living in Ghana, learning that democracy is alive and well, nurtured and preserved by those with the most to lose.

At this time, one year ago, as a high school sophomore, I resided near Cape Coast, a city of 170,000, half again as large as Rochester, Minn. My huge, extended host family lived along the main coastal highway. I attended the local government school, Ghana National College. My host family’s political district, Abura/Asebu/Kwamankese, was one of a very few constituencies in the Central Region to vote for President Mahama. The Central Region, largely carried by Akufo-Addo, is considered a canary-in-the-coal-mine region. Its electoral results almost always mirror the national election outcome.

During my year, I experienced the national campaign in its fullest expression. I witnessed rival “keep fit” groups, sponsored by political parties, try to outdo each other in how physically fit they could be by making their exuberant dance moves increasingly ridiculous. My family’s member of Parliament, serving Cape Coast South, was mobbed as a celebrity at a soccer game. I saw a “Rally for Democracy,” co-sponsored by both major parties, with rhetoric supporting only peaceful and fair elections, not the individual parties themselves.

AFS-Ghana, my youth exchange organization affiliated with AFS-USA, formerly the American Field Service, sponsored election engagement “YES for Peace” youth games. My host family did not favor either major party, but stressed the importance of peaceful elections and voting.

In choosing a leader, Ghana celebrated itself.

In the 2016 U.S. presidential election, 55 percent of eligible voters cast a ballot. Ghana, a nation where many people lack electricity, running water and any mode of transport other than their own two feet, enjoyed 73 percent voter participation.

Living in Ghana as a 15-year-old, I quickly learned that the developing West African nation is acutely aware of its monumental challenges in infrastructure, education and the economy. Cape Coast is Ghana’s seventh-largest city, but we lost power almost daily. Most people carry water to their homes from a well or public tap. Global mining and energy market slowdowns are sharply felt. These could be conditions for political and social instability.

But Ghana is determined to preserve its democracy; losing that would be worse than almost anything else.

Ghana has far surpassed America this year. Returning home, I was shocked by the U.S. election’s dark tenor and by how rapidly things seemed to have changed. We have become a nation divided by hate, with abominable rhetoric echoing from many corners. In Ghana, people buoyantly spilled into the streets, celebrating their democracy’s peaceful election.

As Americans, we share Ghana’s democratic path. We should also learn to share Ghana’s spirit.

Kate Van Hecke, of St. Paul, was a State Department 2015-2016 Kennedy-Lugar YES-Abroad Fellow to Ghana. She is a high school junior at Mounds Park Academy.