Republicans will keep control of the U.S. House of Representatives, handing President-elect Donald Trump’s party full control of the federal government. That’s in part because Democrats fell short in their bid to flip enough battleground districts in Southern California and the Central Valley to help the national party win a majority.

Both parties spent heavily to court voters in six congressional districts from Orange County to Merced County. Though votes still are being counted, Democrats so far have managed to flip only one California seat north of Los Angeles and hold onto another in Orange County.

Along with key races in Pennsylvania, Colorado and Arizona, the GOP performance in California helped push the party over the 218-seat marker to win a majority of seats in the House.

“We prevailed behind star members, excellent winning candidates, and voters fed up with cartoonish and incompetent Democrat policies hurting their lives,” the Congressional Leadership Fund, a national Republican PAC that pumped millions of dollars into California races, said in a statement Wednesday night.

Though California is known as a liberal bastion — Democrats hold every statewide office, dominate the Legislature and congressional delegation and outnumber registered Republicans by a staggering 2-1 ratio — Republicans retain political clout in the Southern California suburbs and vast rural stretches, including the Central Valley farm belt.

This year, Republican incumbents fought for their political lives in razor-thin races for five districts. All were rated toss-ups by The Cook Political Report, an influential elections forecaster.

In the 27th District north of Los Angeles, Democrat George Whitesides defeated Republican Rep. Mike Garcia.

“In Congress, you can count on me to fight to create more good local jobs, lower every day costs, build safe communities, protect Social Security and Medicare, and protect reproductive freedom,” Whitesides said in a statement.

But Whitesides and his fellow Democrats will have little power to do so. On Tuesday, Republican Rep. David Valadao’s victory in the 22nd District moved Republicans within two wins of retaining the House gavel as counting continued in a sliver of races across the country. Then, in a rematch from 2022, Rep. Ken Calvert — the longest-serving Republican in the state’s congressional delegation — defeated rival Democrat Will Rollins in the 41st District, which lies east of Los Angeles.

Calvert, who was backed by President-elect Donald Trump, claimed his 17th term in a district Trump narrowly carried in 2020. With Calvert’s win, the Republican tally reached 217. That became 218 on Wednesday night, securing a majority margin, as Rep. Juan Ciscomani won reelection to a seat representing southeastern Arizona.

Calvert kept his seat despite being handily outraised and outspent by Rollins. Calvert raised $7.5 million and spent $5.8 million, and Rollins raised $11.4 million and spent $9.1 million.

More than $20 million in outside spending also poured into the race, the most of any House district in the state. The Congressional Leadership fund spent $8.2 million to defend the seat, trouncing its Democratic counterpart, the House Majority PAC, which pumped $4.8 million into the race, according to the nonpartisan analysis site Open Secrets.

On Thursday morning, Republican Rep. John Duarte was leading the race for his seat in Merced County’s 13th District as the vote tally continued. Duarte was 3,765 votes ahead Thursday of Democratic challenger Adam Gray, with more than 29,000 ballots to count.

But there were also some bright spots for Democrats.

A razor-thin race between Republican incumbent Rep. Michelle Steel and Democratic attorney Derek Tran in Orange County’s 45th District was still up in the air Thursday. Steel was leading Tran by a mere 349 votes, with an estimated 200,000 ballots left to count in Orange and Los Angeles counties.

Money has also poured into this acrimonious race as Steel has questioned Tran’s proficiency in Vietnamese — an important point for the district’s influential bloc of Vietnamese voters — and sought to link him to the Chinese Community Party in ads. Tran fired back by accusing Steel of “red-baiting” and “xenophobia.” Steel had raised $9.2 million and spent almost $7 million, while Tran raised nearly $5 million and spent $4.3 million as of mid-October.

And Democrats kept a purple Orange County district that was up for grabs after Rep. Katie Porter left the seat to run unsuccessfully for Senate this year. In the closely divided 47th District, Democrat Dave Min defeated Republican Scott Baugh.

But Republicans flipped four seats elsewhere: Colorado’s 8th District, Michigan’s 7th, and Pennsylvania’s 7th and 8th districts.

The GOP election victories in California help ensure that Congress will be onboard for Trump’s agenda, though their narrow majority will require party discipline, which the Republicans haven’t always delivered, having ousted a previous House speaker, Californian Kevin McCarthy.

Trump has promised to carry out the country’s largest-ever deportation operation, extend tax breaks, punish his political enemies, seize control of the federal government’s most powerful tools and reshape the U.S. economy.

Bay Area News Group data journalist Harriet Blair Rowan and The Associated Press contributed to this story.