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 supporter turned critic of President Nicolás Maduro, has rejected her dismissal.
She will face trial for “serious misconduct”, the Supreme Court says.
Meanwhile, a leading opposition figure has been returned from prison to house arrest.
Leopoldo López was taken from his home on Tuesday and spent four days in a military jail.
South American regional bloc Mercosur has suspended Venezuela “indefinitely”, having previously placed it under a temporary ban. It says the country will not be re-admitted until the constituent assembly is scrapped and all political prisoners are released.
Another opponent of the government, Antonio Ledezma, is also back under house arrest after three days in jail last week.
Both opposition politicians had encouraged protests against the constituent assembly, which is dominated by government supporters.
In its first session on Saturday, the assembly unanimously voted to remove Ms Ortega from her post.
The lawyer 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 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 of 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.
Ms 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, reports the BBC.
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 Ms 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%. Violent demonstrations since April have left more than 100 people dead.