BUCHAREST, Romania -- Romania's first female prime minister was sworn in Wednesday as the country's third head of government in a year amid ongoing anti-corruption protests.

Viorica Dancila, 54, a European Parliament lawmaker before being elected premier, and her Cabinet took their oaths of office, which were administered by President Klaus Iohannis.

Dancila won 282-136 votes in Parliament, far more than the 233 votes she needed to lead Romania's current left-wing government, which the European Union has criticized over legislation that critics say will make it hard to prosecute high-level corruption.

Dancila has voiced support for the proposals, which have prompted public protests.

The legislation would ban the use of audio and video recordings in prosecutions. Other aspects include holding judges personally responsible for erroneous rulings, and making it possible to seek financial damages from them.

The previous two prime ministers were ousted because they were perceived as not toeing the ruling Social Democrat party line, and in particular not giving their full support to overhauling the justice system.

Iohannis had harsh words for the new government about the justice system and the economy, saying that there was a "red line" the government shouldn't cross.

"Affecting the independence of the justice system is inacceptable," he told ministers. "The ruling coalition shouldn't ignore the signal sent by hundreds of thousands of Romanians who continue to go on the streets to support the rule of law."

"People want prosperity in a country where politicians respect the citizens," adding recent government fiscal policy had "rattled the population and the business community."

He added: "Instead of simplifying things ... we are faced with uncertainty which risks degenerating into financial instability and major economic imbalances."

Dancila, a European Parliament lawmaker, was a relative unknown in domestic politics until this month. Speaking before the parliamentary vote, she promised to raise wages, reduce bureaucracy and build hundreds of kilometres (miles) of new highways and railway lines by 2020.

Dancila, who will head a Cabinet of 27 ministers, will likely act in the role of an administrator, with government policy decided by powerful Social Democrat chairman Liviu Dragnea, who can't be prime minister because of a conviction for vote-rigging.

A court froze Dragnea's assets in November over a charge of embezzling EU funds. He denies wrongdoing.

She was booed by a small group of protesters as she arrived at parliament Monday. But party members handed her a bouquet of red roses and greeted her with applause as she walked through the palace built by late Communist leader Nicolae Ceausescu, which now houses Parliament.

"The goal of my mandate is for Romania in 2020 to be in the top half of the EU's strongest economies so that young people no longer leave from Romania, and those that have left want to return," Dancila told lawmakers.

Mihai Tudose resigned as prime minister earlier this month after the party withdrew its support for him. He replaced Sorin Grindeanu, who was forced out of office in a no-confidence vote brought by his own party in June.