WASHINGTON (AP) — Republicans ousted Indiana Democratic Sen. Joe Donnelly on Tuesday and held on to a competitive seat in Tennessee, important steps in their drive to retain their hold on the Senate and protect President Donald Trump's conservative agenda for two more years.

The Indiana victory by Mike Braun, a businessman and former state legislator who closely embraced Trump, coupled with GOP Rep. Marsha Blackburn's triumph in Tennessee put Democrats in a grim spot in their longshot drive to capture the Senate control.

It meant that even if every remaining Democratic incumbent was re-elected — which was far from guaranteed — they would have to win all three of the remaining GOP-held seats considered competitive. Those were in Texas, Arizona and Nevada.

While Republicans currently command the Senate only narrowly, 51-49, a crucial piece of math was in their favor Tuesday: The Democrats and their two independent allies were defending 26 seats, Republicans just nine.

Blackburn, a conservative who is also an ardent Trump backer, defeated former Tennessee Gov. Phil Bredesen, 74. Bredesen had promised a bipartisan approach if elected and had won the endorsement of music star Taylor Swift.

The night's news wasn't completely disastrous for Democrats.

Democratic Sen. Joe Manchin was re-elected in West Virginia, a state Trump captured by 42 percentage points in his 2016 election triumph. Democratic incumbents also prevailed in Ohio, Pennsylvania and Wisconsin, Midwestern states that Trump carried narrowly two years ago.

Overall, Democrats were defending seats in 10 states that Trump took in 2016, including five he won by at least a huge 19 percentage points. Trump prevailed in Indiana by 19 points.

Tuesday's midterm elections were among the most bitter in years.

Democrats' longshot prospects for capturing a Senate majority were pinned on expectations that their supporters, roused by revulsion toward Trump, would surge to the polls. Fueling their intensity have been Trump's anti-immigration rhetoric and policies, his efforts to dismantle health care protections enacted under President Barack Obama and the #MeToo movement's fury over sexual harassment.

"Ever since President Trump has been in office, it has just been not the country that I am used to or that I thought I would be in," said Sarah Roth, 22, a Democratic voter from Minnetonka, Minnesota. "And so this really was my opportunity to help this country in changing who is making the decisions."

Democrats also had history on their side: 2002 was the only midterm election in the past three decades when the party holding the White House gained Senate seats.

Republicans were banking on those dynamics being offset by a vibrant economy and by a president whose insult-laden approach to political discourse was as stirring for conservative voters as it was infuriating to liberals. The night's initial results suggested that Trump's nationalistic appeals to hard-right voters, while profoundly divisive, were helping nail down GOP victories in rural, deep-red states.

Trump's racially tinged anti-immigrant rhetoric could hurt Republican candidates in swing states like Arizona and Nevada where college-educated voters could be decisive, but it seemed to be helpful in deeply conservative areas.

"I believe he values immigration, but he wants to make sure we're safe," said Tina Newby of Wetland, Michigan, a GOP voter. "I like the fact that he is not a politician, and I forgive some of the socially incorrect or politically incorrect things that he says."

With Democrats considered a good bet to grab House control from Republicans, keeping the Senate was seen as crucial for the GOP's goals of tax and spending cuts, trade, immigration restrictions, curbs on Obama's health care law and judicial nominations.

With so much at stake, Trump campaigned in over a dozen states with Senate elections since Labor Day, visiting some multiple times. He himself has characterized the election as a referendum on his presidency.

AP VoteCast, a national survey of the electorate conducted by The Associated Press, highlighted the effect Trump was having on voters. Nearly 4 in 10 said they were casting ballots to express opposition to him, while just 1 in 4 said their vote was an expression of support for the president.

The poll also showed that health care, a dominant theme of many Democrats' campaigns, was considered the key issue in Tuesday's election, followed closely by immigration.

In other results, Vermont independent Sen. Bernie Sanders and Democrats Elizabeth Warren of Massachusetts, Kirsten Gillibrand of New York and Minnesota's Amy Klobuchar were easily re-elected. Along with Sherrod Brown, a pro-labor lawmaker re-elected in Ohio, the four are considered potential 2020 Democratic presidential hopefuls.

GOP hopes of gaining a seat from New Jersey were dashed when Democrat Sen. Bob Menendez won a third Senate term. Menendez won in the heavily Democratic state despite a federal bribery indictment that prosecutors dropped this year after a mistrial.

Also victorious was Republican Mitt Romney, the vanquished 2012 GOP presidential candidate who grabbed the Utah seat being vacated by the retiring GOP Sen. Orrin Hatch. Virginia Democrat Tim Kaine, his party's defeated 2016 vice presidential candidate, won re-election to the Senate.

In other states Trump carried in 2016, Democratic Sen. Heidi Heitkamp of North Dakota seemed at greatest peril of losing. Other Democrats fighting for political survival included Missouri's Claire McCaskill and Bill Nelson of Florida. Nelson, 76, faced outgoing GOP Gov. Rick Scott, who poured over $50 million of his own fortune into his campaign, the most in the U.S.

Amid the recent rash of letter bombs and the Pittsburgh synagogue massacre, Trump issued alarming and often unfounded warnings about caravans of migrants crossing Mexico toward the U.S., blaming Democrats, without evidence, for the threat he claimed they pose.

In battlegrounds where Democrats were thought to have chances to gain seats, first-term Democratic Rep. Jacky Rosen was in a close contest with Nevada Sen. Dean Heller, the only Republican seeking re-election in a state Democrat Hillary Clinton won in the 2016 presidential race. Democratic Rep. Beto O'Rourke, a darling of progressives from coast to coast, raised record contributions but faced long odds of ousting tea party Sen. Ted Cruz in Texas.

___

AP reporters Jeff Baenen in Minnetonka, Minnesota, and John Flesher in Traverse City, Michigan, contributed.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.