Image copyright Reuters Image caption Princess Ubolratana has not addressed the issue of the ban directly

The party that nominated a Thai princess to run for prime minister has said it will comply with the king's wishes after he opposed the move.

Thai Raksa Chart is allied to divisive ex-Prime Minister Thaksin Shinawatra.

On Friday, King Vajiralongkorn denounced his sister Princess Ubolratana Mahidol's unprecedented bid for political power as inappropriate.

The candidacy would have broken with the tradition of the Thai royal family publicly staying out of politics.

The party said it complied "with the royal command with loyalty to the king and all members of the royal family".

A palace statement had said such an act would "defy the nation's culture".

Broadcast on all Thai TV networks, the statement said: "Even though she has relinquished her royal titles in writing, she maintained her status and carried herself as a member of the Chakri dynasty.

Image copyright AFP Image caption King Vajiralongkorn says the princess retains her status as a member of the royal family

"Involvement of a high-ranking member of the royal family in politics, in whatever way, is considered an act that defies the nation's traditions, customs and culture, and therefore is considered extremely inappropriate."

The statement cited a passage of the constitution that says the monarchy should maintain political neutrality.

Next month's vote is being closely watched as the first chance for Thailand to return to democracy after five years under military rule.

Analysts say the king's intervention would in any case have been likely to have led to the election commission disqualifying her from the 24 March election.

Bold gambit fails

By the BBC's Jonathan Head in Bangkok

After unusually blunt criticism from King Vajiralongkorn, the Thai Raksa Chart party had no choice but to accept his instruction that members of the royal family could not be brought into politics.

That ends a bold gambit by the anti-military coalition to boost its popularity and insulate itself against charges of being anti-monarchy, by having the king's flamboyant older sister Ubolratana run for prime minister, although her nomination cannot be legally withdrawn.

Ultra-royalists are now demanding that Thai Raksa Chart be dissolved.

That would leave the largest party in the coalition, which is aligned with exiled former Prime Minister Thaksin Shinawatra, still contesting the election, but without an important partner.

Coalition sources say they believed they had the king's acquiescence for his sister to run in the election. If that is the case, either there was a misunderstanding, or he changed his mind.

What has the princess herself said?

Hours earlier, Princess Ubolratana defended her decision to run for office.

In an Instagram post, she reiterated that she had relinquished all her royal titles and now lived as a commoner.

She said she wanted to exercise her rights as an ordinary citizen by offering her candidacy for prime minister. She said she would work with all sincerity and determination for the prosperity of all Thais.

Shortly after the king's statement she posted again without addressing the issue directly, simply thanking Thais for their support and saying that she wanted Thailand to "move forward and become admired and accepted by the international community".

Who is Princess Ubolratana Mahidol?

Born in 1951, Princess Ubolratana Rajakanya Sirivadhana Barnavadi is the eldest child of Thailand's late King Bhumibol Adulyadej. He died in 2016.

She attended the Massachusetts Institute of Technology and after marrying an American in 1972 she gave up her royal title. After her divorce she returned to Thailand in 2001 and once again started participating in royal life.

The princess engages actively in social media and has also starred in several Thai movies.

She has three children, one of whom died in the 2004 Asian tsunami. The other two now also live in Thailand.

Why is the election important?

It will be the first vote since current Prime Minister Prayuth Chan-ocha took power in 2014, overthrowing the democratic government and ousting ex-PM Yingluck Shinawatra, the younger sister of Mr Thaksin.

Both Mr Thaksin and his sister live in self-imposed exile but remain a powerful force in Thai politics, with many in the country remaining loyal to them.

Image copyright Getty Images Image caption Prayuth Chan-ocha is running as a candidate for the pro-military Palang Pracharat party

In 2016, Thais voted to approve a new constitution created by the country's military leaders, which was designed to perpetuate military influence and block Mr Thaksin's allies from winning another election.

But the princess aligning herself with a party allied with Mr Thaksin threatened those plans, correspondents say.

A former general, Mr Prayuth also announced on Friday that he would be running for prime minister in the forthcoming election as a candidate for the pro-military Palang Pracharat party.

Thailand has some of the world's toughest royal defamation "lese-majeste" laws but technically the princess is not covered by them.

However, the royal family is revered in Thailand and rarely criticised, so there are questions around whether any other candidate would want to challenge a member of the royal family.