Rep. Roger Marshall defeated controversial former Kansas Secretary of State Kris Kobach Tuesday evening to win the Republican nomination for a Senate seat being vacated by longtime Sen. Pat Roberts, R-KS.

The win in the GOP primary means that Republican voters in the Sunflower State heeded their party’s advice by choosing the more moderate Marshall over the conservative firebrand Kobach. Republican leadership was concerned that a Kobach win would could ultimately flip the generally safe Senate seat to the Democrats in November’s general election.

"Kansas Republicans knew what was at stake in this primary, and tonight's results prove voters will reject any Democrat efforts to buy this seat,” National Republican Senatorial Committee (NRSC) Chairman Sen. Todd Young, R-Ind., said in a statement. “I'm more confident than ever Kansas will remain part of the Republican Senate Majority.”

Besides besting Kobach, Marshall prevailed in a crowded GOP primary field with the backing of major farm, business and anti-abortion groups but without an endorsement from President Trump.

FOX NEWS ANALYSIS SHOWS SLEW OF MAIL-IN BALLOT ISSUES NATIONWIDE

Many Republicans’ fears about Kobach fueled ad campaigns that cost at least $15 million, with most of the spending by political action committees. Kobach is nationally known for advocating restrictive immigration policies and alienated independent and moderate GOP voters in losing the Kansas governor’s race in 2018.

The race for retiring Roberts’ seat had national implications even though the GOP hasn’t lost a Senate contest in Kansas since 1932.

Roberts declared his support for Marshall after the congressman had picked up endorsements from the U.S Chamber of Commerce, the Kansas Farm Bureau, the National Right to Life Committee and Kansans for Life, the state’s most influential anti-abortion group. Marshall also had the backing of 97-year-old political icon Bob Dole, the former U.S. Senate majority leader and 1996 GOP presidential nominee.

Even with Marshall as the nominee, the GOP faces a potentially competitive Senate race. The Democratic nominee, state Sen. Barbara Bollier has raised more than $8 million for her campaign, a big sum in a low-cost media state like Kansas, with donations flooding in from outside the state. Bollier is a retired Kansas City-area anethesiologist and former moderate Republican who garnered national headlines by switching parties at the end of 2018.

The NRSC’s Young has already painted Bollier as the “hand-picked” candidate of Senate Minority Leader Chuck Schumer, D-N.Y.

“Roger Marshall is a principled conservative who has, and will, deliver for Kansas families, and I look forward to him defeating Chuck Schumer's hand-picked candidate, Barbara Bollier, this November,” Young said.

CLICK HERE FOR THE FOX NEWS APP

For her part, Bollier said she doesn't care which candidate she's going up against and slammed the Republicans on their moves to do away with thee Affordable Care Act during the coronavirus pandemic.

"It doesn't matter who our opponent in #KSSen is, we know that they’ll be a hyper-partisan working to take healthcare coverage from thousands of Kansans in the middle of a pandemic. That’s for sure," Bollier tweeted.

Republicans are trying to keep their 53-47 Senate majority with competitive races in other states, including Arizona, Colorado and Maine.

Fox News’ Paul Steinhauser and The Associated Press contributed to this report.