By Jonathan Head
BBC News, Bangkok
Prime Minister Samak has been besieged by protests
The Thai Prime Minister Samak Sundaravej has been fighting for his political life over the past two weeks.
Thousands of demonstrators from the People's Alliance for Democracy (PAD) have besieged his office at Government House, demanding he step down. The main opposition party has filed a motion of no-confidence in parliament.
He has also faced protests by disgruntled farmers, truck drivers and fishermen.
There have even been rumours of another military coup. Mr Samak has only been in office for five months. So what has he done wrong?
SAMAK'S RELATIONSHIP WITH THAKSIN SHINAWATRA
Having campaigned openly in last December's election as a "Thaksin nominee", Mr Samak was never going to be accepted by those Thais who are still bitterly opposed to Mr Thaksin.
They see the Samak government as a Trojan horse that will eventually ease Mr Thaksin back into power.
The PAD is firmly in this camp. Nothing Mr Samak could have done would have softened their hostility to him, even though the prime minister has often acted independently of the Thaksin loyalists in his party.
It was greeted with brickbats by many Thais when it was announced.
This wasn't really his fault. His party, the People Power Party (PPP), is essentially just Mr Thaksin's old party, Thai Rak Thai, under a different name.
It is run and funded by the same, powerful provincial figures. But with Mr Thaksin and 110 other top TRT officials banned from holding political office, they simply put forward relatives and cronies to take up ministerial portfolios in their place.
Most of these new ministers lacked relevant competences and experience. Their performance has been lacklustre, at best.
SAMAK'S UNDISCIPLINED MOUTH
Mr Samak is a street-brawler of a politician who relishes his reputation for being brutally outspoken.
Protesters have called for the government to resign
This served him well during the campaign; it serves him far less well as prime minister.
He was the first to speculate about a military coup, sending the financial markets plunging, and forcing the army commander to rush out a denial.
He threatened to use force again the PAD protests, but then had to back down. Many Thais are embarrassed by his verbal gaffes.
SAMAK'S ATTACK ON THE CONSTITUTION
Altering the charter introduced last year under the military government was a priority for the PPP.
The charter included a number of provisions aimed at limiting the power of elected governments. But the two clauses Mr Samak targeted were directly tied to his party's and Mr Thaksin's interests - it looked like a self-serving move.
He has now been forced to back down, leaving any amendments to a bi-party parliamentary committee.
SAMAK'S FAILURE TO TACKLE THE ECONOMY
Thailand, like other countries, has been hit hard by rising oil and other commodity prices.
Inflation is up sharply. The price of rice has fluctuated, initially benefiting farmers, then catching them off-guard as prices fell back. The Thai currency has suddenly slipped in value, pushing up the cost of oil even further.
Mr Samak's economic team has blundered around these challenges, without producing any credible policies to address them.
SAMAK'S LACK OF PARTY SUPPORT
Mr Samak was chosen by Mr Thaksin to run the PPP because his close ties to the military and the monarchy were useful to a party disliked by the traditional elite; he has no power-base of his own inside the party.
As a result, he has been unable to control factional rivalry, weakening the party's effectiveness in parliament.
Some of those factions now appear to have lost patience with Mr. Samak, and may be angling to replace him.
THE TEMPLE ROW
On top of all these problems, Cambodia's bid to have an ancient temple on the border with Thailand listed as a Unesco World Heritage Site has sparked off a nationalist backlash against the prime minister.
Mr Samak agreed to support the bid, although the temple's inclusion in Cambodian territory is disputed by many Thais.
The fact that the Foreign Minister, Noppodol Pattama, who negotiated the deal to support the listing, also used to be Mr Thaksin's lawyer, has led some to suspect that he was swayed by Mr Thaksin's business interests in Cambodia.
So what happens next? Samak Sundaravej is a veteran politician whose tenacity and survival skills should not be underestimated.
He will almost certainly survive the vote of no-confidence. The opposition Democrats don't have enough seats to form a viable alternative coalition.
And, although they are too polite to say so, Mr Samak's coalition partners need to stay with him long enough to see some of the big government infrastructure spending projects get going.
It is a poorly kept secret in Thailand that parties rely on getting government positions to replenish their coffers after the expense of an election.
For that reason, forcing Mr Samak to dissolve parliament, and hold another election, is not palatable to any party.
A military coup also seems very unlikely. Army Commander Anupong Paochinda has made it clear he does not want one. Much of the army top brass feel they got little thanks for intervening two years ago. The situation would have to deteriorate dramatically for them to rethink.
If Mr Samak is forced to go, it will probably be by his own party.
But then he would likely be replaced by someone less independent from Thaksin Shinawatra - perhaps his brother-in-law, the Education Minister Somchai Wongsawat, or Finance Minister Surapong Seubwongleee - neither of which would be appealing to die-hard anti-Thaksin groups.
Democracy in Thailand has always been messy. Perhaps never more so than now.