RICHMOND — Democrats snagged the top three statewide offices. Republicans still dominate the House. But who controls the Virginia Senate? That’s not at all clear, even as the General Assembly prepares to open Wednesday.

It could be weeks before that question — one that could determine how much Gov.-elect Terry McAuliffe (D) can get through the legislature — is settled.

The Senate has been evenly split since 2012, with 20 Republicans and 20 Democrats.

But the GOP had control of the chamber because the lieutenant governor, who presides over the Senate and has the power to break ties on most votes, was a Republican.

Come Saturday, Lt. Gov. Bill Bolling (R) will hand over that tie-breaking authority to a Democrat, Lt. Gov.-elect Ralph S. Northam.

That sounds like good news for Democrats, but there’s a catch: Northam is a state senator, and he will leave the Senate Saturday to become lieutenant governor. If Republicans take his seat, that would tip control of the Senate in their favor.

Del. Lynwood W. Lewis Jr. (D-Accomack) led Wayne Coleman (R) in a special election Tuesday to fill replace Northam, but only by the slimmest of margins: 22 votes. The contest is likely headed for a recount.

Even if Lewis holds onto his narrow win, Republicans have another chance to take control. State Sen. Mark R. Herring (D-Loudoun) won the race for attorney general, so he also resigns his seat Saturday.

The contest to fill his seat, scheduled for Jan. 21 because Herring's narrow victory was delayed by a recount, is a three-way contest between Jennifer Wexton (D), a Leesburg lawyer; John Whitbeck, chairman of the 10th Congressional District Republican Committee; and former delegate Joe T. May, who lost his reelection bid last year in the GOP primary and is running an independent.