(CNN) -- The votes were tied 126-126, and it all came down to a marble.

That's how the City Council broke the electoral draw Tuesday night in Spearfish, a little town in western South Dakota with a population fewer than 10,000.

So how'd they get there?

Candidate David Baker and incumbent councilwoman Shawn Dardis each had 126 votes after the election board finished its tally April 14. Dardis contested one of the ballots marked for Baker, saying it was also marked for another candidate in the race.

However, a judge earlier this month ruled that the voter's intent was clearly for Baker, leaving the count tied.

Don't Miss

Spearfish did not have an ordinance that stated what to do in the event of a tied election; nothing on the books called for a runoff. So, officials looked to state law, which says candidates must play a game of chance to determine a winner.

That's why Baker and Dardis each rolled a die before a group of supporters at a special city council meeting Tuesday night. The winner of the highest roll would then decide whether they would pick first from a purple Crown Royal bag containing two marbles -- one black, one white. The candidate with the white marble would clinch the seat.

Dardis rolled a four and Baker a six, leaving the challenger to decide whether to dip first in the bag of marbles.

"I opted that I would grab the marble," Baker told CNN. "I figured I had a 50-50 chance of winning."

He reached in, fished out the white marble and won the council seat.

Baker, 31, owns a concrete business and has always lived in Spearfish. This was his first time running for public office.