Venezuela's chief prosecutor says she was sacked by the new constituent assembly because the government wanted to stop her investigations into alleged corruption and human rights abuses.
Luisa Ortega, a critic of left-wing president Nicolás Maduro, said she rejected her dismissal, condemned by other Latin American countries.
She will face trial for ‘serious misconduct’, the supreme court says.
Meanwhile, the regional bloc Mercosur has suspended Venezuela ‘indefinitely’.
The group says the country will not be re-admitted until political prisoners are released and the constituent assembly is scrapped.
Venezuela had been suspended temporarily in December for not complying with the bloc's regulations.
On Saturday the assembly, which is dominated by government supporters, decided to remove Ortega, 59, from office in a unanimous vote.
Ortega was prevented from entering her office in the capital, Caracas, by dozens of National Guard officers in riot gear, and left on a motorbike amid chaotic scenes.
In a statement (in Spanish) released by the public prosecutor's office, she said Maduro's government was leading a ‘coup against the constitution’.
‘I do not recognise the decision,’ she said about her dismissal. ‘[This is] just a tiny example of what's coming for everyone that dares to oppose this totalitarian form of ruling.’
The supreme court, loyal to Maduro, did not give details of the accusations against her.
Ortega, who broke ranks with the government in March, had opposed the assembly's inauguration on Friday, citing allegations of voting fraud.
Tarek William Saab, a supporter of president Maduro, has been sworn in as her replacement.
Her removal was widely expected but the fact that it was decided on the first working day of the assembly suggested that the new body could take aggressive measures against Maduro's critics, correspondents say.
Mexico, Peru and Colombia have condemned her dismissal.
Maduro says the constituent assembly is needed to bring peace after months of protests sparked by severe economic hardship.
But the opposition says it is a way for the president to cling to power.
The new body has the ability to rewrite the constitution, and could override the opposition-controlled parliament, the National Assembly.
Julio Borges, speaker of the National Assembly, said Ortega's removal was illegal and showed that the country's institutions had been ‘taken hostage by only one hand, only one political party’ through ‘an undemocratic mechanism that is utterly dictatorial.’
Despite being oil-rich, Venezuela is experiencing severe shortages of food and medicines, as well as inflation in excess of 700 per cent. Violent demonstrations since April have left more than 100 people dead.
Want stories like this in your inbox?
Sign up to exclusive daily email
More Stories from Latin America