On Tuesday morning in the small Philippine town of San Teodoro, a local election came to a screeching halt when the two candidates running for mayor each received 3,236 votes. As chance would have it, a coin toss served as tie-breaker to determine the new mayor.

Though a game of chance might seem like an arbitrary way to decide who runs a city — even one with just 15, 810 residents, according to the 2010 census — breaking a tie by drawing lots is clearly sanctioned by Philippine laws. Reny Pagilagan, an election officer who oversaw the coin toss, told the Wall Street Journal that he had presided over another tie between two other candidates back in 2004. “By law, an election tie will have to be broken by drawing of lots. And that could be done either through coin toss, drawing of straws or cards from a pack, or bingo balls,” he told the paper. And you can’t just flip the coin any way you please, either: It must go above the candidates’ heads and bounce at least once on the floor.

After two rounds of coin tossing, Marvic Feraren from the Liberal Party prevailed over rival candidate Salvador Py of the Nacionlista Party to became the new mayor of San Teodoro. “Both of them accepted the result. They shook hands and embraced,” Pagilagan told the Telegraph. Feraren is the son of a former mayor in the coastal town that gained notoriety in 1939 for the gold rush there that attracted thousands of migrants. He also belongs to President Benigno Aquino’s Liberal Party, which currently controls the nation’s House of Representatives.

The Philippines is not the only country to resort to games of chance when anointing political leaders: As the Atlantic reports, a tie in the popular vote in some U.S. states can be settled by coin toss, drawing straws or picking from a hat. The Wall Street Journal also reports that this practice is used for electoral ties in the United Kingdom as well.

Erica Ho was previously a reporter for TIME in Hong Kong where she wrote about technology, pop culture and Asian international affairs. Before that, she worked at Gizmodo, Lifehacker and AOL. She now currently runs Map Happy, a travel-oriented site.