WARSAW, Poland — Polish lawmakers overwhelmingly approved two bills Friday that give the ruling party greater power over the judiciary despite blunt warnings from European Union officials and others that the laws contravene democratic norms.

Supporters in the ruling conservative Law and Justice party said the changes would make Poland’s courts more efficient and more accountable to citizens by giving elected representatives a role in choosing judges.

Opponents said the ruling party, led by leader Jaroslaw Kaczynski, was violating international law and Poland’s Constitution by infringing on judicial independence and the separation of powers.

Opposition lawmakers in a country that threw off decades of communist rule 28 years ago chanted “Dictatorship!” Friday before and after the votes in the lower house of parliament. Grzegorz Schetyna, head of the opposition centrist party Civic Platform, called it a “black day” for Poland’s judicial system.

With emotions running high, some opposition lawmakers even likened the actions to the way the Nazis took power in Germany in the 1930s.

Some said the changes risk further distancing Poland from the EU, which had warned that the laws could cause Poland to lose its voting rights in the bloc.

But Wojciech Skurkiewicz, a ruling party lawmaker, told The Associated Press that “Poland is a proud, free, sovereign nation that has its full rights guaranteed in EU treaties to decide about itself.”

The laws change how the nation’s Supreme Court functions and the process for naming the National Council of the Judiciary, a body that nominates judges. The Supreme Court confirms election results and is the court of last appeal in Poland.

Earlier versions of the new laws were vetoed in July by President Andrzej Duda following mass street protests and condemnation from the EU, which said they would undermine the independence of Poland’s judiciary.

But only small groups of anti-government protesters demonstrated Friday, facing changes that appeared to be unstoppable.

Law and Justice says it has a democratic mandate to reform the judicial system, which it claims never was properly purged after communism fell in 1989 and which it describes as inefficient and run by an privileged caste out of touch with regular people.

The bill relating to the Supreme Court would lower the mandatory retirement age for justices from 70 to 65 and thus force dozens of the 87 justices to step down unless they obtained suspensions from Poland’s president.

The Supreme Court would now have the power to review and overturn verdicts from courts at all levels going back 20 years based on citizen complaints. A provision allowing prosecutors and untrained assessors to rule in judicial discipline cases also has drawn criticism.

The proposed law on the National Council of the Judiciary would give lawmakers the right to choose 15 out of the council’s 25 judges, who so far have been selected by other judges. Candidates would be suggested by groups of citizens or judges, and confirmed by lawmakers.

“The judges will now be equal to ordinary people, they cannot be above them,” Skurkiewicz said.

Critics say judicial independence in Poland had already been compromised in the two years of Law and Justice rule, but that Friday’s bills would complete what they see as a takeover of the courts. In July, the prosecutor general was given the authority to name the heads of all ordinary courts.

The Venice Commission, a board of legal experts with Europe’s top human rights body, the Council of Europe, said the recent changes constituted a “grave threat” to Poland’s judiciary.

Also Friday, the president formally designated the finance minister, Mateusz Morawiecki, to be the country’s next prime minister, and accepted the resignation of the outgoing prime minister, Beata Szydlo, and her Cabinet.

The political shake-up announced late Thursday was seen by critics as an effort to distract people from the passage of the laws on the judiciary.