A coin toss has decided the lucky winner of mayor for a small Philippine town, after rival candidates were tied at the end the vote count, en election official said Thursday.

The dramatic conclusion to the contest for San Teodoro, a farming town of about 16,000 people in the central Philippines, took place in the local election office, with the politicians tossing the coin to decide their fate. “They agreed to a coin toss, with the candidate getting the most heads proclaimed the winner,” San Teodoro election chief Reny Pagilagan told AFP.

He said tension built as the first tie-break competition of five coin tosses each also ended in a draw, with both politicians getting two heads, according to Pagilagan.

Marvic Feraren, a member of the ruling Liberal Party, finally emerged the winner in the second tie-break event, throwing two heads to his opponent’s one. “Both of them accepted the result. They shook hands and embraced,” Pagilagan said.

Pagilagan said Philippine election law stated that tied electoral contests must be settled by the drawing of lots, of which a coin toss was an acceptable variant. Pagilagan said this week’s event was not unprecedented and he had presided over another coin toss in 2004 to decide the winner of the final seat on a council board for a nearby town. More than 44,000 candidates contested about 18,000 posts in Monday’s mid-term elections, from local positions up to seats in the nation’s parliament.