Democrats swept key state legislative and gubernatorial races across the country Tuesday, ensuring that at least 45 million more Americans will live under unified Democratic governance of their states next year and opening the door for sweeping policy changes on issues such as health care and education.

The results mark a dramatic turnabout for Democrats, who had full control of just eight states prior to Tuesday’s elections. Republicans controlled 26 state governments, and 16 were split.

But Democrats rode a wave of voter enthusiasm into key governorships and invested huge sums to flip control of state legislatures. As of Wednesday morning, Democrats were projected to win full control in six new states — Colorado, Illinois, Maine, New Mexico, Nevada and New York — and had broken Republicans’ grip on Kansas, Michigan, New Hampshire and Wisconsin.

Full control of a state government — the trifecta of the state House, state Senate and governorship — brings huge benefits. Parties with full control have far more freedom to enact their policy agendas. In many states, full control also gives the party absolute power over congressional and state legislative redistricting, which means it can draw districts that will be hard for its foes to win. A wave of state-level Republican wins in 2010, ahead of the decennial congressional redistricting, helped produce the GOP’s current dominance of state governments and its eight-year control of the U.S. House of Representatives. Democrats were eager to start reversing that trend this year: This cycle, the Democratic Legislative Campaign Committee committed to spend $35 million, twice what it spent in 2016.

There’s one more set of elections ahead of the redistricting cycle that begins in 2021. But some of this year’s results are baked into that process. Barring impeachment or other unforeseen circumstances, 34 of the 36 governors elected Tuesday will still be in charge when their states get redistricted in 2021. (The governors of Vermont and New Hampshire serve unusual two-year terms and will be up for re-election again in 2020.) Democrats’ wins in key gubernatorial races in states such as Colorado, Kansas, Maine, Michigan, Minnesota, New York, Oregon, Pennsylvania and Wisconsin ensure they’ll have a seat at the table when those states get redistricted.

Democratic gubernatorial victories in Michigan, Kansas and Wisconsin ― three states where Republicans appeared to hold onto the legislature ― were particularly key because they’ve prevented the GOP from holding a trifecta in those states.

“Breaking up trifectas is a huge part of our strategy because it doesn’t allow one party to ram through whatever they want,” said Patrick Rodenbush, a spokesman for the National Democratic Redistricting Committee, a group that former Attorney General Eric Holder created in 2016 to combat Democrats’ disadvantage in redistricting fights. Democratic governors in Pennsylvania and Virginia recently blocked Republican gerrymanders in those states, Rodenbush noted.

Winning governors’ races was also the only realistic way to influence redistricting in states where past gerrymandering all but ensures that Republicans will control the legislature for several more election cycles.

“A lot of those chambers are not coming back to Democrats anytime soon. They’re heavy lifts, long-term, multicycle projects,” said David Daley, the author of Ratf**ked: The True Story Behind the Secret Plan to Steal America’s Democracy, which chronicles Republicans’ aggressive gerrymandering efforts. “But at least Democrats will now have veto power over bad maps.”

Much as Republicans under President Barack Obama sought to fashion their states into islands of conservatism, Democrats expect to use their newfound power to hold many of the Trump administration’s policies at bay.

With Congress gridlocked, “we’ve seen states taking a leadership role in driving policies,” said Jared Leopold, spokesman for the Democratic Governors Association. “Democratic leaders offer an alternative set of priorities to what’s coming out of Washington. …You will see the future of the Democratic Party emerge from the new leaders elected in 2018.”

With Democrats’ new wins, a total of around 112 million Americans will live in Democratic-controlled states come January. Barring shocking shifts, that would still be fewer Americans than the 130 million or so who will live in Republican-controlled states. Even so, Democrats suddenly find themselves in a position to enact significant changes on a state level in health care, voting rights, education and crime. In Maine, which is preparing to expand Medicaid to roughly 70,000 low-income residents, Democrat Janet Mills, a supporter of the expansion, beat a Republican whom many expected to restrict benefits. In Colorado, Democrats flipped the state Senate for trifecta control and chose as governor Jared Polis, who ran one of this cycle’s most progressive campaigns. Incoming Kansas Governor Laura Kelly, who beat Republican Kris Kobach, is expected to work with the Republican legislature to expand Medicaid.

In states such as Illinois, New Mexico and New York, where the party needed to turn only a handful of races to take full control of the state, there are already progressive proposals waiting in the wings. In New York, where Democrats flipped the state Senate for total control of the government, progressives hope to pass long-standing proposals to expand reproductive and voting rights, and overhaul campaign finance laws. In Illinois, a Democrat beat Republican Gov. Bruce Rauner, who had spent years feuding with the Democratic legislature over his cuts to Medicaid. In New Mexico, outgoing Republican Gov. Susana Martinez had vetoed dozens of proposals that passed the Democratic legislature — bills raising taxes, reducing criminal penalties for minor crimes and shoring up education funds. Voters chose a Democrat, Michelle Lujan Grisham, as her successor.

The Trump administration is offering states multiple routes to restrict Medicaid benefits and undermine the Affordable Care Act. A string of Democratic gubernatorial victories may prevent many states from taking that path — such as in Kansas and Michigan where Republican governors requested waivers from the administration to impose work requirements and drug testing on Medicaid recipients. Newly elected Democratic governors now have the power to reject these measures.

Democrats also expect to push for broad changes to education. Colorado Democrats have pledged to increase funding to public schools. J.B. Pritzker, the governor-elect of Illinois, has promised to lower the compulsory school age from 6 years old to 5 years old. In Michigan, Gretchen Whitmer won the governor’s seat with a promise to fund universal all-day preschool.

“2018 could be a really powerful kick to Republicans to say, ‘Hey, maybe you should think about redistricting reforms, because you lost a bunch of seats in 2018 and you don’t know what 2020 looks like,’” said Michael Li, senior counsel for the Democracy Program at the Brennan Center for Justice. “Maybe this is a time to think about what a fair process looks like.”