Rep. Mark Sanford (R-SC) has been one of President Trump’s most regular GOP critics. Now Trump is returning the favor with a last-minute endorsement of his primary rival, which brings up Sanford’s infamous affair.

While en route back from the summit with North Korea in Singapore, Trump took to Twitter to endorse South Carolina state Rep. Katie Arrington (R) in Tuesday’s primary against Sanford, before saying he’d be “better off in Argentina,” a snide reference to Sanford’s affair with an Argentinian woman that drove him from the governor’s office after his staff falsely claimed he was hiking the Appalachian Trail.

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! — Donald J. Trump (@realDonaldTrump) June 12, 2018

Sanford returned to politics by winning his House seat in 2013 even after national Republicans abandoned him for misleading them about his messy personal life.

But while Sanford’s personal peccadillos have left a segment of his district’s GOP voters strongly distasteful of him, it wasn’t until Trump that he had a real political problem.

Sanford was one of the most vocal critics of the president throughout the 2016 campaign, stridently questioning his grasp of the Constitution late in the GOP primaries and demanding that he release his tax returns long after Trump secured the nomination, and has since been a thorn in the side of Trump once he made it to the White House.

With Trump fealty the most potent political issue in GOP primaries this year, Sanford has been forced to spend heavily on TV ads touting his alignment with Trump on some key policies, while looking to paper over his many disagreements with the president.

It’s unlikely Trump’s last-minute tweet will make the difference since there are just a few hours until polls close in South Carolina. But if Sanford loses — a real possibility — it’ll be because of his criticisms of the president. And in the unlikely scenario that neither candidate reaches 50 percent (a kooky Bernie Sanders supporter and perennial Democratic candidate is also on the GOP ballot so it’s possible in a very close race), Trump’s endorsement could have a much larger impact.