WARSAW, Poland — Thousands of Poles marched in Warsaw on Saturday to demand respect for their country’s constitution while denouncing a populist government they accuse of eroding democracy.

Many participants carried Polish and European Union flags during an event promoted as the “March of Freedom” and chanted slogans such as “Constitution!” and “Free courts!”

Two pro-European and centrist opposition parties, Civic Platform and Modern, were the key organizers of the protest, along with a pro-democracy civic group.

In speeches, their leaders accused the ruling right-wing Law and Justice party of chipping away at democratic freedoms with an overhaul of the judicial system that gives the party vast powers over the courts.

EU leaders have urged the Polish government to reverse some of the changes. The government insists it has the political mandate to reform a broken justice system.

Civic Platform leader Grzegorz Schetyna said the government’s opponents are fighting for “freedom, dignity, democracy, the constitution, the independence of the constitutional Tribunal, the independence of courts and Poland in Europe.”

Some protesters held up small copies of the Polish Constitution.

The march was also an attempt by political opposition parties to gain some momentum against the ruling party ahead of local elections this fall and the parliamentary election next year.

“We want to show that we are here, we are together and that we have a plan,” Michal Stasinski, a lawmaker with Civic Platform, told The Associated Press.

City Hall, which is controlled by Civic Platform, said 50,000 people took part. Police called that estimate far too high but did not give their own estimate.

Many march participants also expressed support for a protest that mothers of disabled children have held for more than three weeks in the Polish parliament. The mothers are demanding more state funding to care for their children, but so far have been unsatisfied with what the government has offered them.

Across Warsaw there were other rallies Saturday, including the annual pro-EU Schuman Parade and a march of about 250 farmers, foresters and hunters angry at environmentalists. Some ultra-nationalists turned out for the latter event.