U.S. Rep. Mark Sanford, a vocal critic of President Donald Trump, lost a Republican congressional primary in South Carolina after Trump urged voters to punish Sanford's disloyalty by tossing him from office.

A few hours before polls closed on Tuesday, Trump tweeted that Sanford was "nothing but trouble" and "very unhelpful to me." He backed Sanford's pro-Trump challenger, state Rep. Katie Arrington, for November's congressional elections.

Arrington, who made a campaign issue of Sanford's criticism of Trump, won 50.6 percent of the vote to Sanford's 46.5 percent. That just crossed the 50 percent threshold to avoid a runoff later this month between the top two contenders.