— Democrat Jared Golden defeated Republican Rep. Bruce Poliquin in Maine's 2nd District House race -- flipping the seat after the state calculated its ranked-choice voting results.

It's the first time in the nation's history a federal race has been decided by ranked-choice voting.

Golden won 50.5% to Poliquin's 49.5%, Maine Secretary of State Matthew Dunlap told reporters Thursday afternoon. The flip means Democrats have picked up 33 House seats so far in 2018, with seven races still undecided. Democrats lead in five of those seven seats, all of which are Republican-held districts.

So far, the current balance of power in Washington come January will be 228 Democrats and 200 Republicans in the House.

The tabulation came hours after a judge denied Poliquin's request for a temporary restraining order. The Republican had called into question the constitutionality of the ranked-choice voting process, which Maine's voters approved in a 2016 referendum and used for the first time this year.

In Maine's system, voters rank their choices from first to last. If no candidate gets more than 50% of the first-place votes, then candidates are eliminated one by one -- making the second-place choices of voters who back little-known third-party or independent candidates crucial.

Poliquin narrowly led Golden, 46.2% to 45.6%, after first-place votes were counted. But more than 8% of Maine's voters backed one of the two independent candidates in the race, Tiffany Bond and Will Hoar.

Dunlap's office calculated the ranked-choice voting results Thursday afternoon, broadcasting their Microsoft Excel tabulation on Facebook Live.