Venezuela's new constituent assembly has dismissed Chief Prosecutor Luisa Ortega, during its first day of work.
Ms Ortega, a vocal critic of left-wing President Nicolás Maduro, had opposed the assembly's inauguration on Friday, citing allegations of voting fraud.
Earlier, security forces had surrounded her office in the capital Caracas, preventing her from entering.
Mr Maduro says the new body is needed to bring peace after months of protests sparked by severe economic hardship.
On Saturday the assembly - which is dominated by government supporters - decided to remove Ms Ortega from office in a unanimous vote.
She was replaced by a supporter of President Maduro, Tarek William Saab.
Dozens of National Guard officers in riot gear had taken up position around her office. Sharing pictures of the scene, she tweeted: "I denounce this arbitrary act before the national and international community."
She told reporters that the authorities were trying to hide evidence of corruption and human rights abuses. She added that she would now work to "recover liberty for Venezuela, because we've lost it".
Ms Ortega was aligned with the government until she broke ranks in March. She took many Venezuelans by surprise when she went on live television to denounce the Supreme Court's attempt to strip the opposition-controlled National Assembly of its powers.
The following month, she published a statement defending the right to hold peaceful protests.
In June, she was called a "traitor" by officials after she challenged President Maduro's plan to create a constituent assembly.
On Thursday she called an independent audit of the recent public vote for the constituent assembly.
In a separate development, the South American regional grouping Mercosur suspended Venezuela from the organisation indefinitely on Saturday, further isolating the country.
The opposition, which has controlled the National Assembly since elections in 2015, boycotted last Sunday's vote. It says the constituent assembly is a way for the president to cling to power.
The new body has the ability to rewrite the constitution, and could override the National Assembly.
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.
Among those sitting for the first time in the constituent assembly are Mr Maduro's wife and son.
A close ally of Mr Maduro, former Foreign Minister Delcy Rodriguez, was elected president of the assembly.
Her opening speech attacked the opposition as "fascist" and warned the international community not to interfere.
She also indicated that high-profile opponents could expect swift action against them.
Earlier in the week, politician Jorge Rodríguez, an ally of the president, said it was only a matter of time until Ms Ortega would be removed from her post.