WASHINGTON (AP) — Republicans seized control of the U.S. Senate late Tuesday after flipping Democratic held seats, holding onto GOP incumbents and wresting away the majority for the first time in four years.

The unexpected battleground of Nebraska pushed Republicans over the top. Incumbent GOP Sen. Deb Fischer brushed back a surprisingly strong challenge from independent newcomer Dan Osborn.

Democrats watched their efforts to salvage their slim majority slip out of reach.

Early in the night, Republicans flipped one seat in West Virginia, with the election of Jim Justice, the state’s governor, who replaced retiring Sen. Joe Manchin, and then another in Ohio when Democratic Sen. Sherrod Brown lost to wealthy newcomer Bernie Moreno.

Democratic efforts to oust firebrand Republicans Ted Cruz of Texas and Rick Scott of Florida collapsed.

And there are more Senate races still to come. The focus now turns to the Democratic “blue-wall” states of Pennsylvania, Michigan and Wisconsin, where Democrats are fighting to protect seats and avoid a Republican sweep of the Senate.

It’s a political coda for outgoing Senate GOP Leader Mitch McConnell, who has made a career charting the path to power and recruiting wealthy Republicans in races that topped $2 billion with outside spending.

With control of Congress at stake, the contests for the House and Senate will determine which party holds the majority and the power to boost or block a president’s agenda, or if the White House confronts a divided Capitol Hill.

The House races are in a state-by-state slog. For Republicans, it’s a chance to gain full control of Congress as they try to sweep into power. For Democrats, a House majority will give them an important check on the GOP’s power and force compromise in Washington.

In the end, just a handful of seats, or as little as one, could tip the balance in that chamber.

The key contests are playing out alongside the first presidential election since the Jan. 6, 2021, attack on the Capitol, but also in unexpected corners of the country after what has been one of the most chaotic congressional sessions in modern times.

Top House races are focused in New York and California, where Democrats are trying to claw back some of the 10 or so seats where Republicans have made surprising gains in recent years with star lawmakers who helped deliver the party to power.

Other House races are scattered around the country in a sign of how narrow the field has become. Only a couple of dozen seats are being seriously challenged, with some of the most contentious in Maine, the “blue dot” around Omaha, Nebraska, and in Alaska.

Vote counting in some races could extend well past Tuesday.

Several states will send history-makers to the new Congress.

Voters elected two Black women to the Senate, Democrat Lisa Blunt Rochester of Delaware and Democrat Angela Alsobrooks of Maryland, in a historic first.

Blunt Rochester won the open seat in her state while Alsobrooks defeated Maryland’s popular former governor, Larry Hogan. Just three Black women have served in the Senate, and never before have two served at the same time.

And in New Jersey, Andy Kim became the first Korean American elected to the Senate, defeating Republican businessman Curtis Bashaw. The seat opened when Bob Menendez resigned this year after his federal conviction on bribery charges.

In the House, candidate Sarah McBride, a Democratic state lawmaker from Delaware who is close to the Biden family, won her race, becoming the first openly transgender person elected to Congress.

What’s still unclear is who will lead the new Republican Senate, as longtime leader McConnell prepares to step down from the post.

South Dakota Sen. John Thune, the No. 2 Republican, and Texas Sen. John Cornyn, who previously held that post, are the front-runners to replace McConnell in a secret-ballot election scheduled for when senators arrive in Washington next week.

Voters said the economy and immigration were the top issues facing the country, but the future of democracy was also a leading motivator for many Americans casting ballots in the presidential election.

AP VoteCast, an expansive survey of more than 110,000 voters nationwide, found a country mired in negativity and desperate for change as Americans faced a stark choice between former President Donald Trump and Vice President Kamala Harris.

Congress plays a role in upholding the American tradition of peacefully transferring presidential power. Four years ago, Trump sent his mob of supporters to “fight like hell” at the Capitol, and many Republicans in Congress voted to block President Joe Biden’s election. Congress will again be called upon to certify the results of the presidential election in 2025.

“We’re in striking distance in terms of taking back the House,” House Democratic leader Hakeem Jeffries, who is in line to make history as the first Black speaker if his party wins control, told The Associated Press during a recent campaign swing through Southern California.

But House Speaker Mike Johnson, drawing closer to Trump, predicts Republicans will keep “and grow” the majority. He took over after Kevin McCarthy was booted from the speaker’s office.

One of the most-watched Senate races, in Montana, may be among the last to be decided. Democrat Jon Tester, a popular three-term senator and “dirt farmer” is in the fight of his political career against Trump-backed Tim Sheehy, a wealthy former NAVY Seal, who made derogatory comments about Native Americans, a key constituency in the Western state.

In the Southwestern states, Arizona firebrand Republican Kari Lake has struggled against Democrat Ruben Gallego in the seat opened by Sen. Krysten Sinema’s retirement. In Nevada, Democratic Sen. Jacky Rosen has been holding out against newcomer Sam Brown.

Democrats had intensified their challenges to Cruz and Scott in states where reproductive rights have been a focus in the aftermath of the Supreme Court decision rolling back abortion access. Scott defeated Democrat Debbie Mucarsel-Powell, a former member of Congress.

While Texas hasn’t elected a Democrat statewide in almost 30 years, Colin Allred, a Dallas-area congressman and former NFL linebacker, positioned himself as a moderate and leaned into his support for reproductive rights amid Texas’ abortion ban, which is one of the strictest in the nation.

Brown’s loss in Ohio to Moreno, an immigrant from Bogota, Colombia, who built a fortune as a luxury car dealer and blockchain entrepreneur, puts the Democrats on the edge of losing Senate control. A three-term senator, he is the first incumbent to lose reelection.

The Ohio race between Brown and Moreno, who was backed by Donald Trump, is the most expensive of the cycle, at some $400 million.

What started as a lackluster race for control of Congress was instantly transformed once Harris stepped in for Biden at the top of the ticket, energizing Democrats with massive fundraising and volunteers that lawmakers said reminded them of the Obama-era enthusiasm of 2008.

Billions of dollars have been spent by the parties, and outside groups, on the narrow battleground for both the 435-member House and 100-member Senate.

Fallout from redistricting, when states redraw their maps for congressional districts, is also shifting the balance of power within the House, with Republicans gaining three seats from Democrats in North Carolina and Democrats picking up a second Black-majority seat in Republican-heavy Alabama.

Lawmakers in the House face voters every two years, while senators serve longer six-year terms.

If the two chambers do in fact flip party control, as is possible, it would be rare.

Records show that if Democrats take the House and Republicans take the Senate, it would be the first time that the chambers of Congress have both flipped to opposing political parties.

___

Associated Press writers Stephen Groves, Kevin Freking and Farnoush Amiri contributed to this report.