RICHMOND, Va. — A Republican won a Virginia state House of Delegates race so close that its outcome was determined by pulling the candidate’s name out of a ceramic bowl Thursday.

Virginia officials drew Republican incumbent David Yancey’s name out of a bowl in a drawing today that ended a hotly contested House race. Watch the drawing in the player above.

The win allows the Republicans to maintain a slim majority in the House, though a final tally is still uncertain because the Democrat in the race could ask for another recount. The outcome of another close legislative race is also in doubt because it’s locked in a court battle.

The drawing of lots Thursday drew quite a crowd at the Virginia elections board meeting. Officials detailed how the drawing would work and Del. David Yancey’s name was chosen first out of a ceramic bowl, making him the winner of the 94th District race.

The name of each candidate was printed on a piece of paper and placed into separate film canisters. The canisters were put into a cobalt-blue-and-white ceramic bowl made by a local artist, stirred around and Yancey’s name was chosen.

It’s been nearly 50 years since a legislative seat was settled by drawing lots in Virginia.

For today's drawing, election officials will pull from this wheel thrown, stoneware bowl from @vmfa Resident Potter Steven Glass. This photo of the blue exterior belies the "red iron oxide" interior, but rest assured, the piece bears no partisan color affiliations. pic.twitter.com/Ys460Hoke9 — Saraya Wintersmith (@SWINTERSMITH) January 4, 2018

The race between Yancey, a three-term incumbent, and Democratic challenger Shelly Simonds has bounced back and forth since the November election, when Virginia Democrats — fueled by voter anger directed at Republican President Donald Trump — wiped out a 66-34 advantage held by Republicans in the House. The election has been widely seen as a potential harbinger of the 2018 midterm congressional elections.

Simonds appeared to have lost the November election by 10 votes, but on Dec. 19, she won a recount by a single vote. The next day, a three-judge panel declared a tie based on a previously uncounted vote for Yancey.

At the heart of the dispute in the race for a seat in the oldest legislative body in the country is a single ballot on which the voter filled in the bubble for both Simonds and Yancey. The voter also drew a single slash through the bubble for Simonds and picked Republican candidates in statewide races.

The ballot wasn’t counted during the recount and was identified after a Republican election official raised concerns the following day.

With Yancey’s win, Republicans hold a slim, 51-49 advantage over Democrats in the Virginia House. But the race may not be over. Simonds could ask for another recount, a move that would likely delay a winner being declared before the 2018 legislative session begins next week. That would still allow Republicans to elect a speaker and make committee assignments based on a 50-49 advantage.

The balance of power in the House could shift again because a lawsuit is pending over the results of another House race in Northern Virginia. Democrat Joshua Cole lost to Republican Bob Thomas by 73 votes in a recount. But voters filed a federal lawsuit after at least 147 ballots were found to be assigned to the wrong districts. A federal court hearing on that election is schedule for Friday.

The General Assembly is set to reconvene Wednesday.

A similar tie vote was settled by lot at least once before in Virginia. In 1971, Republican William H. Moss Sr. appeared to lose the election for a seat in northern Virginia. But after a recount ended in a tie, Moss was declared the winner after a blindfolded state elections official pulled his name out of a large decorative cup, according to news reports at the time.