A Thai court has ordered Prime Minister Yingluck Shinawatra and several cabinet ministers to step down.
The Constitutional Court ruled that Ms Yingluck acted illegally when she transferred her national security head.
The ruling follows months of political deadlock. Anti-government protesters have been trying to oust Ms Yingluck since November 2013.
The remaining cabinet members have nominated the commerce minister to replace Ms Yingluck.
"The cabinet has agreed to appoint Niwattumrong Boonsongpaisan to act as caretaker prime minister," Deputy Prime Minister Phongthep Thepkanjana said.
Ms Yingluck had been accused of abuse of power in improperly transferring Thawil Pliensri, her national security chief appointed by the opposition-led administration, in 2011.
Appearing in court on Tuesday, she had rejected the suggestion that her party had benefited from the move.
But the court ruled against her, saying a relative had gained from the transfer.
"The prime minister's status has ended, Yingluck can no longer stay in her position acting as caretaker prime minister," a judge said in a statement.
In a press conference after the court ruling, Ms Yingluck thanked her followers for their support over the past two years, pointing out that she was democratically elected.
"We held true to the principles of honesty in running the country, and never acted corruptly, as we were accused," she told reporters.
The ruling also ousted nine cabinet members who the court said were complicit in the transfer.
An adviser to the prime minister, Nopaddon Pattama, said the court's decision was binding.
"She really has no choice but to be bound by the decision because the constitution says the judgement of the court is binding on all parties, although we are going to make a political protest."
He said remaining cabinet members would continue performing their duties until a new cabinet was formed.
Earlier this month, the ruling party called a general election for July, after the snap election held in February was ruled invalid by the courts.
"We have to focus on the general election so that the Thai people can determine their own future," he said.
The deputy leader of the opposition Democratic Party (PDRT), Kiat Sittheeamamorn, said the court decision would not end the political crisis.
His party maintained that political reform was needed before an election could be held, he said. "So the differences are still there and we have to see what will unfold in the next few days."
The court move could trigger protests by supporters of the government, which remains very popular in rural areas.
Anti-government protests began in the Thai capital late last year, with demonstrators blockading several parts of the city.
In response, Ms Yingluck called a snap general election in February that her party was widely expected to win. But the protesters disrupted the polls and the election was later annulled.
Ms Yingluck's supporters believe that the courts are biased against her and side with the urban elite at the heart of the protest movement.
Thailand has faced a power struggle since Ms Yingluck's brother, Thaksin Shinawatra, was ousted by the military as prime minister in a 2006 coup.
Mr Thaksin and his family are hated by an urban and middle-class elite who accuse them of corruption and abuse of power.
But Mr Thaksin's policies won him huge support in rural areas, and both the elections since the coup have returned Thaksin-allied governments to power.
Court rulings have in the past been a key factor amid political turbulence in Thailand.
In December 2008, a government of Mr Thaksin's allies fell from power after a court disbanded their political party for electoral fraud, allowing the opposition to form a government.