Image copyright Reuters Image caption Mark Sanford is expected to centre his campaign on cutting government debt and spending

Donald Trump has lashed out at Mark Sanford, the latest Republican to challenge the US president in the party's primary contest.

Mr Trump described Mr Sanford, a former South Carolina governor, and two other hopefuls as "badly failed candidates".

The president also mentioned Mr Sanford's extramarital affair with an Argentine woman in 2009.

Analysts do not expect Mr Trump's challengers to succeed in wrestling the Republican mantle from him.

No sitting president in the modern era has lost the race to be nominee for their own party, and Mr Trump remains very popular with Republicans.

In April, former Massachusetts Governor Bill Weld became the first person to challenge Mr Trump.

He was followed by conservative radio host and former lawmaker Joe Walsh at the end of August.

Mr Walsh has described President Trump as a "narcissist".

The Republican National Convention, at which the nominee will be formally chosen, will take place in late August 2020 after a series of state primary elections and party caucuses.

But some state Republican parties, including in South Carolina, have decided not to hold primaries in 2020 - to clear the path for Mr Trump and save money.

What did President Trump say?

In a series of tweets, Mr Trump recalled the scandal in June 2009 when Mr Sanford went missing for several days, with his staff telling reporters he had gone to hike the Appalachian Trail. Mr Sanford later admitted he had instead gone to Argentina to see his mistress.

Mr Trump described Mr Sanford's mistress as his "flaming dancer friend". It is unclear why he used these words, but this could be a reference to media reports that Mr Sanford first met the Argentine woman at an open-air dance.

Mr Trump also said his three potential rivals were "stooges, all badly failed candidates".

What about Mr Sanford's decision to run?

Mr Sanford, aged 59, announced that he would challenge Mr Trump during an interview with Fox News on Sunday.

"I think we need to have a conversation on what it means to be a Republican. I think that as a Republican party we have lost our way," Mr Sanford said.

"We have lost our way on debts and deficits and spending... The president has called himself the king of debt, has a familiarity and comfort level with debt that I think is ultimately leading us in the wrong direction."

Mr Sanford is expected to centre his campaign on cutting government debt and spending.

Cracks in the Republican foundation

Donald Trump now has three official challengers for the 2020 Republican presidential nomination.

That is remarkable, given the president's current popularity within the party. And even though none of the candidates appears to pose a serious threat to the president, it could be a sign of trouble ahead.

Barack Obama, George W Bush, Bill Clinton and Ronald Reagan all were able to cruise to their party's nomination in their successful re-election bids without even token opposition. George HW Bush and Jimmy Carter both faced strong challenges - and subsequently lost in the general election.

A primary challenge to an incumbent president can expose weaknesses and distract from general-election preparations.

While the president's campaign team will surely grind along, Mr Trump may find it difficult to resist mixing it up with his intra-party opponents - even if denying them attention is the strategically better move.

While the president likes to boast of his high approval ratings among Republicans, the mere presence of these challenges indicates that there is at least some dissention in the ranks. That's nothing new, and Mr Trump surmounted greater unrest in 2016.

But if 2020 is a close contest, even small cracks in the foundation could prove decisive.

Who is Mark Sanford?

He first served in Congress in 1995, representing South Carolina's first congressional district. He later served as the state's governor for two terms from 2003-2011. He then returned to the House in 2013.

Mr Sanford criticised Mr Trump during the 2016 presidential election but ultimately supported him. However, he would become one of his toughest Republican critics in Congress when Mr Trump took office.

That stance cost him the Republican primary when his seat was up for re-election last year. He was beaten by a pro-Trump challenger who went on to lose the election to her Democratic opponent.

Who will take on Trump in 2020?

Election day is still more than a year away but the race to become the Democratic challenger to Mr Trump is already well under way.

Find out who is already running and who might join them.