Rep. Roger Marshall won the Republican Senate nomination in Kansas on Tuesday night, defeating former secretary of state Kris Kobach and easing GOP fears that a victory by the conservative firebrand could have cost them a seat in November.

With about 64 percent of the vote counted, Marshall, a two-term congressman backed by the Republican establishment, had 39 percent of the vote and was projected to win by the Associated Press. Kobach had about 26 percent of the vote.

At his victory party, Marshall received a congratulatory call from President Trump and put the president on speaker for his supporters to hear.

“I want to congratulate everybody, and Roger, that’s an incredible race. And that’s — now we have to win on November 3rd . . . but congratulations to everybody, that’s a big night,” Trump said, according to a video Marshall posted on Twitter.

Republicans have held the seat, without much of a contest, for more than 100 years, including the four terms of Sen. Pat Roberts, who is retiring.

While Trump has waded into other congressional primaries at the behest of party leaders, he has stayed curiously silent in this primary despite a furious effort by allies of Senate Majority Leader Mitch McConnell (R-Ky.) to block Kobach, who lost the governor’s race in 2018 and has worried the GOP that he would put the seat in greater jeopardy.

These establishment figures feared that Kobach would take the most reliably Republican seat in the Senate — by the end of this year, the GOP will have held it for 152 of the 160 years it has existed — and put it in peril in a general-election season in which Republicans are playing defense in four times as many races as the Democrats.

Marshall, a physician who represents the 63-county “Big First” district, started in politics by ousting a flamboyantly conservative incumbent, Tim Huelskamp, in a 2016 primary.

But Marshall, who supported former Ohio governor John Kasich’s presidential bid, arrived in Washington with Trump. He questioned the cost of the president’s border wall proposal in 2017 but flipped that position after Roberts announced his plan to retire, creating an open Senate seat. In a final debate last month, Marshall said he “will always support the president’s policy on immigration.”

In an interview, Marshall gave Trump an “A-plus” for his handling of the coronavirus pandemic.

Marshall will face state Sen. Barbara Bollier, a former Republican who left that party in 2018 and has a massive war chest that her campaign will immediately get to turn against Marshall.

As of July 15, she had $4.2 million left to spend, while Marshall was down to $1 million.

Kansas was one of five states that held primary elections Tuesday, with Democratic voters in Michigan and Missouri refereeing the latest disputes between the younger, far-left activists pushing for a more ideologically aggressive Congress as opposed to an older, more establishment-friendly liberal base. Voters in Arizona and Washington state also cast ballots.

Rep. Steve Watkins, who three weeks before the Kansas primary was charged with voter fraud, was defeated in the GOP primary Tuesday night.

Even before he faced felony charges, Watkins’s hold on his congressional seat was tenuous, as state Treasurer Jake LaTurner challenged him from the right. Watkins had shrugged off the three felony counts, calling the alleged violations an innocent mistake and saying he looked forward to “setting the record straight.”

“This is clearly hyper-political,” he said during a televised debate that began shortly after news of the charges broke July 14. “I haven’t done anything wrong.”

Topeka Mayor Michelle De La Isla won the Democratic nomination for a seat that Watkins won with just 47 percent of the vote in 2018.

In Detroit, Rep. Rashida Tlaib (D) faced a rematch, of sorts, of her upset victory in the 2018 race to succeed John Conyers Jr. (D).

Tlaib, who made national headlines her first day in office in January 2019 by crudely guaranteeing to impeach Trump, prevailed over Brenda Jones, the Detroit City Council president who lost the 2018 race by just 900 votes.

Tlaib benefited then from running in a crowded primary, which splintered the district’s majority-Black electorate among several candidates vying for the job. This time, she faced only Jones.

House Speaker Nancy Pelosi (D-Calif.), who clashed early with Tlaib and other young female freshmen in what was labeled the “Squad,” announced her endorsement of the incumbent after an outside group supporting Jones distributed a leaflet showing Jones standing next to Pelosi, smiling.

In Missouri, Rep. William Lacy Clay lost the Democratic primary, falling to Cori Bush, an activist who entered politics after the Ferguson protests in 2014 and tapped into the recent energy of the Black Lives Matter movement to upset the 10-term congressman.

The Associated Press projected Bush as the winner in the St. Louis-based district.

“We’ve been called radicals, terrorists,” Bush told supporters in St. Louis. “We’ve been dismissed as an impossible fringe movement. But now, we are a multiracial, multiethnic, multigenerational, multifaith mass movement.”

Justice Democrats, a political outfit that helped launch Rep. Alexandria Ocasio-Cortez (D-N.Y.) two years ago, supported Bush.

Both of those House seats are safely in Democratic hands and will not affect the size of the majority.

Kobach, who lost the governor’s race to Democrat Laura Kelly in 2018, faced an unrelenting line of attack from a McConnell-aligned super PAC that recycled criticism that he faced two years ago from Democrats.

The Harvard, Yale and Oxford-educated candidate captured the secretary of state’s office in the 2010 tea party wave. Capitalizing on the controversies around ACORN, a community organizing group with an expansive voter registration program, Kobach obtained new powers for his office and began tightening voter registration rules and pursuing lawsuits to punish suspected voter fraud. At the same time, he shaped Arizona’s S.B. 1070 immigration law, which gave police new powers to detain undocumented immigrants and barred “sanctuary” policies.

David Weigel and John Wagner contributed to this report.