WARSAW — Poland’s Parliament on Friday adopted widely condemned legislation to reshape the country’s courts, shrugging off criticism from the European Union and local opponents that the measures would threaten the rule of law and place judges more firmly under government control.

Leaders of the right-wing ruling party, Law and Justice, have long championed the laws as necessary to fix a broken judicial system and rid it of corruption. Jaroslaw Kaczynski, the party’s leader, and other officials have also defended Poland’s sovereign right to structure its courts without outside interference.

But Grzegorz Schetyna, head of the leading opposition party Civic Platform, told journalists after the vote: “It’s a dark day for Polish democracy. Something embarrassing and shameful happened.”

Members of the ruling party did not speak during Friday’s parliamentary debate, saying they did not want to “provoke” opponents. But after a protest group named Citizens of the Republic of Poland called upon Poles to converge on Parliament, several hundred people gathered outside. Some carried a huge Polish flag, sang the national anthem and chanted, “Freedom, equality, democracy.”