President Donald Trump welcomed Thailand's junta leader to the White House on Monday — a rare instance of a military ruler being feted in Washington before even a nominal return to civilian rule.

Prime Minister Prayuth Chan-o-cha was greeted at the South Portico by Trump and first lady Melania Trump as he arrived for talks and a working lunch. The visit comes three years after Prayuth seized power in a military coup, and days after the elected leader whose government he ousted was sentenced in absentia to five years in prison.

Human rights groups are outraged, but it gives a shot in the arm to U.S. relations with its oldest ally in Asia, which has moved more into China's orbit since Washington scaled back ties because of the military takeover.

Get Breaking News Delivered to Your Inbox

The Trump administration, like the Obama administration before it, maintains that relations with Thailand will only be fully restored when democracy returns. But rolling out the red carpet for Prayuth reflects a shift in U.S. foreign policy priorities. Trump espouses a doctrine of "America First," prioritizing U.S. trade and strategic interests. He's more willing to engage with anti-democratic leaders and less troubled by their human rights records.

That's not been lost on observers in Thailand, whose diplomatic relations with Washington date back to 1833. Deep military ties were forged in the fires of the Vietnam War.

In an editorial, The Nation, a Thai newspaper, said the junta views the invite to Washington "as a nod to legitimacy in the absence of an electoral mandate." It contrasted that with President Barack Obama's disapproval of the coup, which "soured relations between our countries and forced the generals to lean heavily on China."

It's not that unusual for U.S. presidents to meet autocrats in the Oval Office, but coup leaders are more contentious.

Perhaps the closest recent comparison to Prayuth would be former Pakistani army chief Gen. Pervez Musharraf, who emerged as a close ally of President George W. Bush in the war on terror. Musharraf first visited the White House in 2002, three years after he seized power from an elected leader and before he'd rammed through a national referendum to endorse his presidency.

Trump has barreled through criticism about outreach to authoritarian foreign leaders as he looks to shore up America's long-standing alliances.

He praised Philippine President Rodrigo Duterte for his deadly war on drugs that has left thousands dead, according a leaked transcript of an April phone call. In the same month, Trump welcomed Egyptian President Abdel-Fattah el-Sissi to the White House — something that Obama avoided. El-Sissi had taken power in a 2013 coup and later was elected president.

Like el-Sissi, Prayuth has given up his military uniform. But he's still the head of a junta. The military took power in 2014 to restore order after violent political turmoil in Thailand. The unrest has abated, but human rights groups say that's come at a heavy price in what used to be one of the most vibrant democracies in Asia.

"Civil society, human rights and good governance in Thailand are under attack," said T. Kumar, Amnesty International USA's advocacy director for Asia. "The military government has restricted freedom of expression and peaceful assembly, creating an environment where people risk arrest and persecution for exercising their basic human rights. If these laws are not repealed, fear and repression could become the new normal in Thailand."

A new constitution that critics say was tailor-made for the military to retain effective control has been approved by popular referendum although without open debate. Elections have been repeatedly pushed back and are not expected before 2018. All political parties are restricted.

Prayuth's White House visit comes less than a week after a Thai court sentenced former Prime Minister Yingluck Shinawatra, whose government was ousted in the coup, to five years in prison for alleged negligence in a money-losing rice subsidy program. Yingluck fled the country before the verdict. She says she is innocent, and her supporters call the charges against her politically motivated.

A U.S. National Security Council spokesman, who was not authorized to speak publicly on planning for the visit and requested anonymity, said the U.S. will continue to urge Thailand to return to participatory democracy and restore civil liberties. He declined to say whether those points would be raised by Trump, but said the president could discuss how to strengthen U.S.-Thai relations.

After the coup, the United States stopped military assistance and training programs — a largely symbolic step but one that has gone down badly with Bangkok. Under Trump, the U.S. has authorized more arms sales.

John Sifton of Human Rights Watch predicted there wouldn't be substantial discussion on human rights on Monday. "Trump praises autocratic leaders the world over with little comment on their abuses," Sifton said.

Walter Lohman at the right-leaning Heritage Foundation said if Trump did raise democracy with Prayuth it would be behind the scenes, which he argued would be most effective with a country sensitive to foreign criticism.

"We need to be concerned about human rights and democracy, but it can't dictate our relationships with our allies," Lohman said.