Democrats were facing tougher battles than they expected in bids for control of the Texas House of Representatives and other state legislative chambers after weeks of optimism about their chances in down-ballot races, according to preliminary election results.

Although dozens of races remained too close to call Wednesday morning, Democrats were bracing for some disappointing losses as Republicans won several key races in North Carolina and Florida.

According to partial returns, Democrats were trailing in several races they had hoped would deliver their party the majority in the Texas House. Democrats also were falling short in efforts to take retake the North Carolina House and Senate.

Republicans appeared to expand their influence in state legislatures in Kentucky, Ohio and Rhode Island, where GOP challenger Barbara Ann Fenton-Fung ousted House Speaker Nicholas Mattiello, one of the state’s most powerful politicians. Republicans also have unseated the minority leader in the Georgia House of Representatives.

“State Democrats spent hundreds of millions of dollars to flip state chambers — so far, they don’t have a damn thing to show for it,” David Abrams, the deputy executive director of the Republican State Leadership Committee, said in emailed statement.

A spokeswoman for the Democratic Legislative Campaign Committee (DLCC) said it was premature for either party to claim victory. Democrats were still waiting for key races to be called in Arizona, Pennsylvania, Michigan, Minnesota and Iowa, all states where the party also hoped to contend.

“The 2020 election is still days away from being settled,” Christina Polizzi, a DLCC spokeswoman, said in a statement. “We always knew this election was going to be difficult — we’re running on extremely gerrymandered maps. There are millions of votes still to be counted and we’re going to make sure every one of them is counted.”

The outcome of dozens of races that remain uncalled will decide control of statehouses across the country, capping off campaigns that will determine which party gets the upper hand to redraw future congressional districts.

In early returns, Democrats appeared to have made some modest gains in the North Carolina legislature, with party leaders claiming they flipped at least one seat in the House of Representatives and another in the state Senate — but Republican leaders said they believe they’re poised to retain majorities in both chambers.

In Florida, the GOP appears to have repelled an effort by the Democrats to make inroads in that state’s Republican-controlled government. In a hotly contested state Senate race for an open seat in suburban Orlando, Democratic challenger Patricia Sigman was trailing Jason Brodeur by about 8,000 votes, with all precincts reporting. Republicans, meanwhile, claimed they were poised to potentially expand their majority in the Florida House after Fiona McFarland won an open seat in Sarasota.

For much of the fall, battles for state legislative seats have been largely overshadowed by the contentious campaign for the presidency, but in recent weeks, both parties have pumped tens of millions of dollars into races that could transform some of the nation’s most conservative legislative bodies.

Republicans control 59 out of the 99 state legislative chambers, an advantage that has allowed them to enact restrictions on voting and abortion rights, block expansion of Medicaid in some states, and hinder Democrats from imposing restrictions to combat the ongoing coronavirus pandemic.

Democrats had been hoping to flip as many as seven state legislative chambers, including in the battleground states of Arizona, Iowa, Michigan, Minnesota, North Carolina, Pennsylvania and Texas. They were also seeking wins in Florida, Georgia and Wisconsin.

If successful, Democrats would have more influence to block conservative policies and to foil the nation’s increasingly conservative federal courts. Democrats are also seeking more influence over the once-in-a-decade congressional redistricting process that begins next year, which could block efforts to dilute the political power of minorities, city dwellers and other traditionally Democratic constituency groups.

The DLCC has been particularly focused this year on winning more legislative seats in the Midwest and in the Sun Belt, targeting Republicans who represent diversifying suburban communities.

Some of the races saw record spending, with candidates raising more than $1 million for what had traditionally been low-cost, grass-roots campaigns.

Texas has been a major battleground, with Democrats zeroing in on suburban Dallas and Houston in hopes of winning the nine seats needed to retake the House. Republicans have held the Texas House, Senate and governor’s mansion since 2003.

In Minnesota, where George Floyd was killed as Minneapolis police attempted to arrest him in May, Democrats need win to two seats to regain the majority in the state Senate. That would give Democrats control of both state legislative chambers and the governor’s mansion.

In Arizona, Democrats believe they have a chance to take control of both the state Senate and the House, needing to flip two House seats and three Senate seats to end Republican control of the state legislature for the first time since 1966, though the state still has a Republican governor.

Democrats were also optimistic about their chances in Iowa, where the party needed to win four seats to gain control of the House.

In Michigan, Democrats hoped to regain the state House by picking up four additional seats.

And in North Carolina, Democrats need to flip six House seats and five Senate seats to take control, though some are in Republican territory.

Democrats have a chance to flip both legislative chambers in Pennsylvania, but their best shot is in the state House, where they would need to net nine seats to do so.

Both Republican and Democratic strategists have said it may take weeks to determine the final outcome of all the House races because of record numbers of mail-in ballots that could take a considerable amount of time to tally.

Although Democrats expected to pick up more legislative seats nationwide than Republicans, Austin Chambers, president of the Republican State Leadership Committee, noted that Democrats were defending more than 100 seats that Trump carried in 2016.

“Given the environment we are in, and the onslaught of liberal money that we are facing, it’s actually surprising that there haven’t been more chambers moved off the map into the Democrats’ column,” Chambers said.

In addition to Texas, Republicans were especially focused on defending their legislative majorities in Florida and Georgia.

Republicans hold 23 of 40 Florida Senate seats and have a 26-seat majority in the Florida House, according to the National Conference of State Legislatures.

In Georgia, Democrats need to flip 16 seats to win the house.

Although few expect that Democrats can win control of that chamber, Republicans fear they will suffer losses in the Atlanta suburbs.