Mr Samak was a TV chef before becoming prime minister
Thai Prime Minister Samak Sundaravej has been ordered to resign after being found guilty of violating the constitution over a TV cookery show.
His entire cabinet has also been ordered to step down.
Mr Samak was found to have violated a ban on ministers having outside interests by taking money from a private company to host a TV show.
However, the ruling People Power Party (PPP) has vowed to re-appoint Mr Samak as prime minister.
"I insist that our party leader will be the prime minister," Wittaya Buranasiri, the chief whip of the six-party coalition led by the PPP, told reporters.
In court in Bangkok, Judge Chat Chonlaworn said that Mr Samak had "violated Article 267 of the constitution" and that "his position as prime minister has ended".
Mr Samak cooking on television
The judgment, broadcast live on television and radio, was greeted with loud cheers and claps from Mr Samak's opponents, who have occupied his office compound since the end of last month.
However, Mr Samak has not been banned from standing again for prime minister, and it will be 30 days before the court's decision comes into effect.
Thailand has had its fair share of crises recently, says the BBC's Jonathan Head in Bangkok, but this is one that even the Thais are baffled by.
For the past two weeks, the Thai government has been paralysed by thousands of protesters who have occupied its office, calling for Mr Samak to resign.
26 Aug: Protesters occupy government buildings, demand the government step down
28 Aug: PM Samak promises no use of force against the protesters
30 Aug: Samak rules out resignation, after meeting with Thailand's king
1 Sept: A late-night clash between pro- and anti-government groups leaves one dead. Samak declares a state of emergency
4 Sept: Samak proposes a national referendum
9 Sept: Court orders Samak to resign for violating constitution
They have said they will remain there until Mr Samak leaves office.
Mr Samak, a self-proclaimed foodie, hosted a popular television cooking show, Tasting and Grumbling, for seven years before becoming prime minister.
He continued to present the programme for two months after becoming prime minister, saying that any money he received was only used to cover his expenses.
HAVE YOUR SAY
The Thai PM is already reeling from the deepening political crisis and this court ruling puts another nail in his political coffin
Pancha Chandra, Belgium
However, the constitutional court has ruled that "his employment at the company can be considered an employment", and said Mr Samak gave "conflicting testimony".
There was also an attempt to fabricate evidence "to hide his actions", the judge said.
Protesters accuse Mr Samak of being a proxy for former PM Thaksin Shinawatra, who was ousted in an army coup in 2006 amid accusations of corruption and abuse of power.
Tension spilt into bloodshed last week, when a man was killed in clashes between pro- and anti-government groups in Bangkok, prompting the government to impose emergency rule in the capital.