Rep. Mark Sanford, a Republican who represents South Carolina’s 1st Congressional District, found out Tuesday that losing the support of the president is lethal in a GOP primary.

Sanford, a conservative who has frequently criticized the president, faced a primary challenge from state Rep. Katie Arrington, who campaigned as a Trump ally. Less than three hours before polls closed Tuesday, Arrington was rewarded for her loyalty with an tweeted endorsement from the president, who said Sanford was “very unhelpful” and “nothing but trouble.”

While Trump frequently tosses out endorsements to lawmakers he likes, the support for an opponent was new — and noteworthy. Sanford is a conservative member of the House Freedom Caucus, a group whose membership aligns themselves most closely with the president.

“I’m going to lose this race," Sanford told voters Tuesday night shortly before 11 p.m. ET, according to the Associated Press. It's a feeling Sanford isn't used to. Despite having to resign as governor over an affair in 2009, Sanford has won every other election he competed in.

Sanford's traditionally red district is on Democrats’ radar for November because it is wealthy and educated, demographics the left hopes will be turned off by Trump's performance. Democrats say going against Arrington could make the race more competitive than if Sanford had been their opponent.

Sanford is the second incumbent Republican to lose his primary race this cycle. Rep. Robert Pittenger lost his North Carolina race last month, but Pittenger and his opponent, Mark Harris, both ran as Trump fans.

Arrington wasn’t the only woman to win on Tuesday. In races across the country when women ran they emerged as their party’s nominees. In Virginia’s 10th Congressional District — a top pickup opportunity for Democrats in the fall — a female won a crowded Democratic primary and will face off against GOP Rep. Barbara Comstock, who also won her race.

Voters made their choices in South Carolina, Virginia, Maine, North Dakota and Nevada Tuesday. Here's the rundown:

South Carolina

South Carolina Gov. Henry McMaster was forced into a runoff after he failed to secure over 50 percent of the vote. Unlike Sanford, McMaster — who was an early endorser of the president’s — got Trump’s blessing. McMaster led his nearest opponent by more than 20 percentage points, but he failed to secure a majority.

Another district that will see runoff — or two runoffs: the Democratic and Republican races to replace retiring Rep. Trey Gowdy in the 4th District. After Gowdy announced he would retire at the end of his term, the contest to replace him became one of the nation's most crowded congressional races. The seat is expected to stay red, so whoever wins the Republican nomination has a good chance of representing the district in Washington.

At the state level Republican Jason Elliott declared victory in his nomination for re-election. Elliott became the first openly gay legislator in what has traditionally been a heavily conservative District 22.

Virginia

Virginia State Sen. Jennifer Wexton easily won a crowded primary for Virginia's 10th Congressional District. Democrats see Virginia’s 10th Congressional District and GOP Rep. Barbara Comstock — who easily won her primary — as a top pickup opportunity in November

Former CIA agent Abigail Spanberger won the Democratic primary for Virginia's 7th Congressional District. That seat is another one Democrats believe they can be competitive in.

Virginia establishment Republicans were unable to stop Trump stalwart and Prince William County Board of Supervisors chair Corey Stewart, who won the nod as their GOP nominee for Senate. Stewart has vowed a "vicious" campaign against Democratic Sen. Tim Kaine.

Kaine, who was Hillary Clinton's 2016 vice presidential pick, is considered mostly safe in November, but Republicans hope to make the general election competitive. That’ll be more difficult with Stewart. Polling has Kaine up by double-digits. Stewart ran unsuccessfully for his party’s nomination for governor last year. He campaigned in support of Confederate monuments.

Maine

Voters in both parties will be choosing their nominee for governor because their current governor is term-limited and will finish his tenure this year.

Democrats are watching who makes it out of the primary for Maine’s 2nd Congressional District. The district is held by a Republican but used to be represented by a Democrat so the left is hoping a wave election and the right candidate could put it back in their hands.

In Maine, voters spent Tuesday ranking their candidates in a new voting system called Instant Runoff Voting. First-choice votes are counted and if no one got over 50 percent the candidate with the lowest number of votes is removed from the race. Those who gave that candidate their first-choice pick have their votes redirected to their second choice. The process is repeated until a candidate has a majority of the vote and is declared the winner.

Supporters of the system say it ensures the winner receives the majority of the vote and is more Democratic, while critics worried it would be confusing and could delay results. Voters used the system Tuesday at the same time they voted on a provision that would repeal ranked-choice voting.

As of midnight Tuesday only about half the state's votes had been counted with no results for contested primaries. I wasn't immediately clear if instant runoff voting would need to be used.

Nevada

There were full primaries for two open seats in Nevada, both held by Democrats but considered competitive in the fall, the 3rd and 4th Congressional Districts. Susie Lee, who works in education, won the Democratic nomination for the 3rd District. Steven Horsford, a former House member, won the Democratic nomination for the 4th District.

Republican Sen. Dean Heller escaped what was shaping up to be a competitive primary challenge from businessman Danny Tarkanian when Trump asked Tarkanian to leave the race and run for the nomination for Nevada’s 3rd District instead. Tarkanian narrowly lost the general election for that seat in 2016. Rep. Jacky Rosen (who represents the 3rd District) won the Democratic nomination.

Adam Laxalt, the state's attorney general won the GOP nod for governor. And U.S. Rep. Mark Amodei defeated conservative activist Sharron Angle in the GOP primary for re-election. Angle unsuccessfully challenged then-Senate majority leader Harry Reid, D-Nev., in 2010.

North Dakota

There were no surprises in the state's Senate race. Democratic Sen. Heidi Heitkamp will face the state’s single House member, GOP Rep. Kevin Cramer, in the fall.

The matchup for Cramer's seat was confirmed. Republican State Sen. Kelly Armstrong will go against Democratic former state Sen. Mac Schneider. Democrats say the seat is worth watching in November, particularly if Heitkamp is able to turn out the vote.

Contributing: Kirk Brown, Gabe Cavallaro and Angelia Davis, The Greenville (S.C.) News, and Elizabeth Beyer, USA TODAY, and the Associated Press.