President Trump flexed his political muscle and proved he has the power to sway Republican voters Tuesday when his last-minute attack on U.S. Rep. Mark Sanford, R-S.C., helped defeat the former governor – a frequent critic of the president – in Sanford’s primary for re-election to the House.

State Rep. Katie Arrington, who was endorsed by the president, scored a surprise victory over the scandal-scarred Sanford for the GOP nomination for his seat.

In addition to South Carolina, there were primaries in Maine, Nevada, North Dakota and Virginia Tuesday to pick candidates for the Nov. 6 general election.

Most races brought good news for President Trump and sent a clear warning to Republican critics of the president: your attacks on a president popular with Republican voters could send you into political retirement.

GOP candidates would be wise to remember that lesson. They will need the support of Trump loyalists in remaining primaries and in the November election.

In a tweet late Tuesday afternoon – just three hours before polls closed in South Carolina – President Trump wrote: “Mark Sanford has been very unhelpful to me in my campaign to MAGA. He is MIA and nothing but trouble. He is better off in Argentina. I fully endorse Katie Arrington for Congress in SC, a state I love. She is tough on crime and will continue our fight to lower taxes. VOTE Katie!”

The president’s reference to Argentina was a dig at Sanford’s secret trip to that nation while he was governor to meet a woman for an extramarital affair. Sanford falsely claimed he was hiking on the Appalachian Trail for six days while he was really in Argentina. Sanford resigned as governor in 2011 when his affair was exposed, but won election to the House two years later for a district he had previously represented for six years.

Arrington campaigned as a loyal supporter of President Trump and ran TV commercials featuring criticisms Sanford had made against the president. Her campaign used President Trump’s endorsement Tuesday in a robocall to 50,000 homes to make voters aware he was supporting her.

“We are the party of Donald J. Trump,” Arrington said in her victory statement. During the campaign she said at one point that Sanford should not be returned to Washington because he was “bashing our captain, President Trump.”

Also in South Carolina, incumbent GOP Gov. Henry McMaster, one of the first statewide elected officials anywhere in America to have endorsed Donald Trump during the 2016 presidential primaries, finished atop a competitive field in a five-way race.

But because McMaster received less than a majority of the vote he will face John Warren in a GOP runoff later this month. In November, the runoff winner will face Democrat James Smith, a state legislator and Afghanistan veteran, who easily won a three-way primary.

In the Republican primary for the U.S. Senate nomination in Virginia, Prince William County Board of Supervisors Chairman Corey Stewart – who made an obvious point of adopting both President Trump’s agenda and campaign style and strongly embraced the president – eked out a narrow win against St. Rep. Nick Freitas, while Bishop E. W. Jackson finished a distant third.

In November Stewart will face Sen. Tim Kaine, who was unopposed in his own party in his re-election bid. Kaine was Hillary Clinton’s vice presidential running mate in 2016.

The one place where Trump support may have actually worked against a candidate on the Republican side was in Virginia’s 10th Congressional District, which runs from an affluent area just outside Washington into the exurbs and rural areas at the state’s tip.

In that race, incumbent Republican U.S. Rep. Barbara Comstock was able to easily beat back challenger Shak Hill, a former U.S. Air Force officer whose attacks on his opponent centered on her lack of support for President Trump and the Trump agenda.

Comstock is, however, a better fit for the swing district than Hill and her renomination makes it much more difficult for the Democrats – who picked state Sen. Jennifer Wexton as their candidate for the seat – to win in November.

The fight for control of the U.S. House of Representatives is a matter of numbers. The Democrats need to flip 23 GOP-held seats in order to retake the majority and carry out their agenda, much of which has to do with stopping President Trump, reversing what he’s done thus far, and trying to impeach him.

Democrats can’t do that if they can’t pick up seats like Comstock’s, in a district which Hillary Clinton carried by almost 10 points in the 2016 presidential election.

If Democrats can’t win back the House and take control of the Senate, President Trump can continue to move forward on his agenda of new tax cuts, further deregulation of the economy, and filling vacant slots in the federal judiciary with strict-constructionist judges.

In addition to South Carolina, here’s a look at the other state primaries held Tuesday.

MAINE

Republicans picked businessman Shawn Moody as their candidate to replace term-limited Republican Gov. Paul LePage. The winner of the Democratic gubernatorial primary remains undetermined because of a complex ranked-choice voting system. None of the three Democratic contenders topped 50 percent of the primary vote.

NEVADA

In the race for governor, state Attorney General Adam Paul Laxalt easily won the GOP nomination against two other candidates. He starts the general election an almost prohibitive favorite against Clark County Commissioner Steve Sisolak.

Sisolak emerged on top in the Democratic primary in a battle with fellow Commissioner Christina Giunchigliani, who had the support of Hillary Clinton and was considered the more progressive of the two major Democrats in the race.

In the race for U.S. Senate, the Democrats overwhelmingly picked first-term U.S. Rep. Jacky Rosen to go up against GOP incumbent Sen. Dean Heller, who easily won the Republican primary. Heller is considered by many to be the most endangered of the Republican senators seeking re-election in November, but may be aided by a strong campaign by Laxalt.

Nevada has been trending Democratic over the last decade but much of that was due to the influence of now-former Senate Democratic Leader Harry Reid. With Reid in retirement, the calculus may shift.

The marquis race for the U.S. House will be in the state’s open 3rd Congressional District, comprised mostly of areas of Clark County outside Las Vegas. The winner of the Republican primary Tuesday was Danny Tarkanian, son of the legendary University of Nevada, Las Vegas basketball coach, who died in 2015.

Tarkanian will face Democrat Susie Lee, who won an overwhelming victory in her party’s primary against two candidates Tuesday. Lee has Rep. Rosen’s support and the support of Reid and former Vice President Joe Biden.

NORTH DAKOTA

The November election for U.S. Senate should be one of the most competitive in the nation. It pits Democratic incumbent Heidi Heitkamp, who is seeking a second term, against the state’s lone member in the U.S. House, Republican Kevin Cramer. Hietkamp did not face a Democratic primary challenger and Cramer won the GOP primary in a landslide against one opponent with nearly 88 percent of the vote.

Heitkamp won six years ago with just over 50 percent of the vote, while Cramer was re-elected in 2016 with 69 percent in a state President Trump carried by double digits. Some of those close to Cramer have complained that the White House has been too friendly to his Democratic opponent, offering her photo ops and kind words that are considered unhelpful to Republican plans to take the seat.

VIRGINIA

In addition to the races for Senate and Barbara Comstock’s House seat, in the 2nd Congressional

District around Virginia Beach Republican Rep. and former Navy SEAL Scott Taylor easily won his primary for re-election, making it much easier for the GOP to keep the seat in the fall. Democratic Elaine Luria won big in her primary and will face Taylor.

There's a lot at stake in November. The Democrats believe they can take back the U.S. House because of a big, blue wave that will crash over the open seats and seats where Republicans were elected in 2016, despite having been carried by Clinton for president.

But as the primaries go on, that wave looks to be shrinking down to a trickle. There’s little evidence to support the blue wave theory despite Democrats once again showing in some national polls that they are opening up a lead on the generic ballot. The results in Tuesday’s primaries didn’t get them all that much closer to where they want to be.