WASHINGTON -- Republicans retained Senate control Tuesday after ousting Democratic incumbents in Indiana, North Dakota and Missouri, delivering a victory to U.S. President Donald Trump by preserving the chamber as a showplace for his conservative priorities for two more years.

To seal the win, the GOP drew backing from hard-right voters in rural, deep-red states, where Trump's nativist, racially tinged rhetoric and insult-laden discourse were as stirring for some conservatives as they were infuriating to liberals elsewhere.

"Donald Trump went out and worked his tail off," Sen. Cory Gardner, R-Colo., who heads the Senate GOP's campaign committee, said in an interview. He cited Trump rallies that drew thousands in crucial states during the campaign's closing weeks and added, "The president was THE factor."

The significance of the Republican victory in the Senate, which the party has dominated for the past four years, was magnified because Democrats wrested House control from the GOP. That's a sure-fire formula for two years of legislative gridlock and positioning for the 2020 presidential and congressional elections.

Nevada Sen. Dean Heller, the only GOP incumbent seeking re-election in a state Democratic presidential candidate Hillary Clinton won in 2016, became the only Republican senator to lose. First-term Democratic Rep. Jacky Rosen ousted him, attacking him for backing last year's Republican effort to repeal President Barack Obama's health care law.

Republicans retained Senate seats in the South, Midwest and West and ensured at least a 51-49 majority, equal to their current margin. With three races unresolved early Wednesday, Republicans stood a chance of expanding their majority with wins possible in Florida, Arizona and Montana.

They paved their path to victory by defeating Democrats Joe Donnelly of Indiana, Heidi Heitkamp of North Dakota and Missouri's Claire McCaskill. They kept competitive seats in Texas, where Sen. Ted Cruz fended off Rep. Beto O'Rourke, the well-financed liberal darling, and Tennessee, where Rep. Marsha Blackburn prevailed.

Trump called Senate Majority Leader Mitch McConnell, R-Ky., "to congratulate him on the historic Senate gains," White House spokeswoman Sarah Sanders said. It was just the second midterm election in over three decades when the party holding the White House gained seats.

The Republican Senate win was especially significant because that chamber confirms nominations, including for Supreme Court justices and federal judges, a top GOP priority.

The GOP agenda includes tax and spending cuts, trade, immigration restrictions and curbs on Obama's health care law. Short of compromises, perhaps on infrastructure, its initiatives will go nowhere in the House.

Even passing many bills will be difficult for the Senate. The GOP will fall short of the 60 votes needed to break Democratic filibusters, procedural delays that kill legislation.

Though Republicans entered the night commanding the Senate only narrowly, a crucial piece of math worked for them: Democrats and their two independent allies defended 26 seats, Republicans just nine.

"Senate Democrats faced the most difficult political map in 60 years," said Sen. Chris Van Hollen, D-Md., chairman of Senate Democrats' political arm. He lauded his party for winning at least half the 10 seats they were defending in states Trump carried and preventing Republicans from capturing a filibuster-proof majority.

Blackburn, a conservative and ardent Trump backer, defeated former Tennessee Gov. Phil Bredesen, 74. Bredesen had promised a bipartisan approach if elected.

Heitkamp lost to GOP Rep. Kevin Cramer, whom Trump persuaded to seek the Senate seat. McCaskill was denied a third term by Josh Hawley, 38, Missouri's hard-right attorney general, who called McCaskill too liberal for the state.

Democratic Sen. Joe Manchin was re-elected in West Virginia, which Trump captured by 42 percentage points. Democratic incumbents prevailed in Ohio, Pennsylvania, Michigan and Wisconsin, which Trump carried narrowly.

Tuesday's midterms were among the most bitter in years, with Trump stoking conservatives' fears of caravans of immigrants traversing Mexico and inaccurately painting Democrats as broadly striving to bring socialism to the U.S. He acknowledged the contest would be a referendum on his presidency.

Democrats hoped their supporters' would surge to the polls. Fueling their intensity were Trump's anti-immigration stances, his efforts to dismantle health care protections enacted under 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."

AP VoteCast, a national survey of the electorate conducted by The Associated Press, highlighted Trump's impact. 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.

"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."

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. All three and Sherrod Brown, a pro-labour senator victorious in Ohio, are considered potential 2020 Democratic presidential contenders.

Democrat Sen. Bob Menendez won a third Senate term in New Jersey, 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 an open Utah seat.

AP VoteCast is a nationwide survey of more than 120,000 voters and nonvoters conducted for the AP by NORC at the University of Chicago.

------

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