SEOUL — President Trump on Tuesday expressed “great confidence” in the Saudi Arabian regime that has been accused of conducting a purge of political rivals by Crown Prince Mohammed bin Salman as he eyes an eventual ascension to the throne.

Trump wrote on Twitter that the crown prince and King Salman “know exactly what they are doing” and the president accused those who have been detained since Saturday night in a sweeping series arrests of “milking their country for years.”

Saudi authorities swept up some of the most powerful and recognizable names in the country, including members of the Saudi royal family, cabinet ministers, titans of media and industry, and former officials. The campaign has been cast as an effort to root out deep-seated corruption in the Middle East nation, but critics have called it a ruthless effort by Mohammed bin Salman to consolidate power ahead of the king's death or abdication of power.

President Trump has expressed a willingness to work with several leaders who have been accused of human rights abuses. Here are some of the most controversial. (Patrick Martin, Jenny Starrs/The Washington Post)

The crown prince visited Trump at the White House in March in a meeting a Saudi official called a “turning point” in bilateral relations as the two shared similar views over Iran's destabilizing behavior in the region. Trump has been sharply critical of Iran and last month announced he would move to decertify the Iranian nuclear deal, leaving it to Congress whether to determine new sanctions against Tehran. He was treated to a lavish reception during a visit to Riyadh in May, his first foreign trip.

Trump issued his tweets shortly before leaving Tokyo for a short flight to Seoul for the third leg of a 12-day trip to Hawaii and five Asian nations. Saudi Arabia is an absolute monarchy, and Trump's bid to establish closer relations in an effort to fight terrorism could provide crucial political support for Prince Salman to avoid broader repercussions if he abuses his power.

Analysts said the detentions on Saturday were part of an intensifying drive to centralize power under the crown prince. The effort has included sidelining potential challengers from rival branches of the royal family, and a crackdown on dissidents, including clerics, over the past few months.