HONG KONG — Thailand’s election commission on Monday excluded a Thai princess from its list of candidates for prime minister in the upcoming elections, ending her brief and dramatic entry into politics after opposition from her brother, the king.

The election commission’s exclusion was widely expected after a late-night statement from King Maha Vajiralongkorn just hours after his elder sister put her name forward as the candidate for a populist political party on Friday.

In a statement, the commission said that its decision was based on the king’s command, in which he called his sister’s bid “extremely inappropriate” and “against the nation’s traditions, culture and customs.”

Princess Ubolratana Rajakanya Sirivadhana Varnavadi, 67, stunned Thailand when she was nominated by the Thai Raksa Chart Party, aligned with ousted prime minister Thaksin Shinawatra and his populist political movement. She broke a long-standing tradition in which the Thai monarchy is seen as above the political fray and allied herself with Thaksin’s movement, long criticized as anti-monarchist and anti-establishment. 

The election commission, in its statement Monday, added that members of the royal family should refrain from politics and cannot “hold any political office.” 

The commission’s list did include Thailand’s current prime minister and junta leader, Pra­yuth Chan-ocha, running under the banner of the pro-military Palang Pracharat Party, which is widely expected to win.

The Thai military, led by Pra­yuth, staged a coup in 2014 to overthrow the last elected government and its prime minister, Yingluck Shinawatra, Thaksin’s sister. The March elections will mark the first vote since the coup.

Thailand’s monarchy is deeply revered in society and has been seen as a unifying force above the divisions in the country. The government operates as a constitutional monarchy, in which the monarch is the head of state and the prime minister is the head of government. 

Ubolratana on Saturday said in an Instagram post that she wanted the country to “move forward and be admired by international countries.” She did not comment on her candidacy and could not be reached for comment Monday. 

A petition has been filed with the election commission to disqualify the Thai Raksa Chart Party entirely and exclude it from the election. The party was set up as an alternative to Thaksin’s Pheu Thai Party, in case it were to be dissolved by election authorities ahead of the vote.

Thaksin’s movement has won every democratic election in Thailand since 2001, but he and his sister live as exiles, wanted on corruption and other charges they say are politically motivated. 

The election commission’s statement on Monday did not mention the Thai Raksa Chart Party. 

Paritta Wangkiat reported from Bangkok.