Democrats have a challenging path to capturing the Senate in 2020. Republicans currently have a 53-47 majority, which means that to take control, Democrats will need, at a minimum, a net gain of three seats and the vice presidency (the VP breaks ties in the Senate). But even if Democrats pick up exactly three seats and win the White House, they could still miss out on controlling the Senate. How? If the new president leaves behind a vacant Senate seat in a state with a Republican governor.

Specifically, if Bernie Sanders of Vermont or Elizabeth Warren of Massachusetts wins the general election, their empty Senate seats could prevent Democrats from taking control if the chamber ends up split 50-50. That’s because their states are led by Republican governors, who would probably appoint a fellow Republican in their place. (Five other Democratic senators are running for president, but their states are led by Democratic governors who would appoint their Senate replacements, which means that their seats would almost certainly remain in Democratic hands.)

The good news for Democrats is that both Massachusetts and Vermont have laws that call for expedited special elections to fill Senate seats, so an appointed Republican might not be in place very long (unless of course the appointee were to win the special election). But at least during the appointment period, Republicans would have an edge in the Senate. And that could delay confirmation of the new Democratic president’s Cabinet and judicial appointees, as well as the passage of White House-backed legislation. Other bad news for Democrats: If the appointee were to run in the special election, there’s at least a small chance that person could win and keep the seat in GOP hands.

A President Warren or President Sanders could shorten the amount of time that an appointed GOP senator would be in office, however, by resigning from the Senate before January 2021, when the presidential inauguration would take place. According to the laws of both states, if Warren or Sanders were to quit the Senate in November 2020, after winning the general election, the Massachusetts special election would likely be in mid-to-late April, and the Vermont special election would happen by mid-February. If they waited until January 2021 to resign, the Massachusetts election would be in June, and the Vermont one would happen by April.

It wouldn’t be the first time for a president-elect to exit the Senate soon after the general election. Barack Obama, for example, resigned from his Senate seat less than two weeks after he won the presidency in 2008. However, it might be difficult for Sanders or Warren to resign from the Senate that early if there’s any delay in knowing who won the presidential contest.

Democrats would be expected to win a special Senate election in either Massachusetts or Vermont, considering that they are the second- and fourth-most Democratic-leaning states in the country. But unexpected things happen in special elections. Take the 2010 special Senate election in Massachusetts, which was held after the death of Democratic Sen. Ted Kennedy. The state in 2010 was just as blue as it is today, but Republican Scott Brown beat Democratic state Attorney General Martha Coakley by about 5 points. (Brown lost the seat to Warren in 2012.)

Of course, Massachusetts Gov. Charlie Baker and Vermont Gov. Phil Scott are moderate Republicans, and they might try to avoid controversy by appointing a moderate or unambitious Republican to the Senate. And in Vermont’s case, because the rules governing special elections require a quick turnaround — within three months of a Senate seat becoming vacant — Scott could skip an appointment altogether and just let the special election fill the seat. Scott is up for reelection in 2020, so he might prefer to avert any sort of backlash that could arise from picking a Republican to replace Sanders. In this scenario, Scott’s decision not to appoint someone to the seat ahead of the special election would still leave the Republicans with a 50-49 edge in the Senate.

Capturing the presidency is at the top of the Democrats’ agenda for 2020, but the impact of a Sanders or Warren victory could complicate things in the Senate. A few months of Republican control of either a Massachusetts or Vermont Senate seat might not seem like a big deal to Democrats right now. But if one seat is the difference between Democratic or GOP control of the Senate in the first months of a Sanders or Warren presidency, the new president’s priorities might pay the price.

Check out all the polls we’ve been collecting ahead of the 2020 elections.