Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today's WorldView newsletter.

In varying parts of the world, recent political crises have hinged on the activist role played by supreme courts. All democracies need courts and judges to defend the rule of law, safeguard constitutional order and check executive power. But we've seen a number of glaring instances this year when courts have instead derailed or threatened to subvert the democracies they're supposed to protect.

This month, Poland was convulsed by protests against the government's attempt to revamp the nation's courts. The country's right-wing leadership saw the judiciary as a liberal impediment to its rule and pushed legislation that would allow government officials more direct control over the selection of judges. Critics at home and politicians abroad saw the move as part of a worrying authoritarian turn. Broad popular opposition and the prospect of international censure seem to have stalled the controversial reforms — for now.

For a demonstration of what happens when you can't guarantee the independence of the judiciary, consider Pakistan. On Friday, after months of hearings, Pakistan's Supreme Court dismissed the country's elected prime minister, Nawaz Sharif. The judges disqualified Sharif from office for hiding his family's assets, tapping into widespread public frustration with the Sharif family's notorious "'mafia'-like financial dealings," my colleagues reported.

Sharif's prominent political rival, former cricketer Imran Khan, hailed the ruling as "the beginning of a new era in the history of Pakistan" in which there would no longer be "two types of laws, one for the weak and one for the wealthy and powerful." Khan, who brought the charges against Sharif last year, will vie to replace him in elections expected next summer.

A Sharif supporter carries a party flag during a rally in Rawalpindi, Pakistan, on Saturday. (Aamir Qureshi/Agence France-Presse via Getty Images)

But many others were not convinced. Since Pakistan's founding almost 70 years ago, no prime minister has finished his or her term. The country is subject to constant cycles of political instability and the overweening influence of a forever-meddling military. Pakistan's senior judiciary is hardly a neutral actor, either.

It "has an abysmally poor record of defending democracy against authoritarian interventions," academic Aqil Shah, author of "The Army and Democracy: Military Politics in Pakistan," wrote in the New York Times. "While there have been a handful of dissenting judges, the Supreme Court has legalized each one of Pakistan’s three successful military coups in 1958, 1977 and 1999. ... The empowered judges have become media-courting populists and have typically joined forces with the military by using allegations of corruption against disobedient prime ministers."

In this case, Sharif is far from alone in Pakistan's political firmament when it comes to allegations of graft or financial impropriety. His supporters see him as a victim of a plot marshaled by anti-democratic forces and abetted by the high courts.

"Pakistan’s politicians are not paragons of probity, but corruption is not the main reason for Mr. Sharif’s predicament," Shah wrote. "He has been ousted from the prime minister’s position twice before — in 1993 by presidential decree, in 1999 by General Musharraf’s coup — primarily for asserting civilian supremacy over the military and seeking peace with India."

Other analysts were less gloomy, finding reasons for optimism in the measures taken against Sharif, a striking verdict given the seeming impunity with which Pakistan's powerful political clans long operated.

"This is a blow to the democratic process but a victory for democratic principles,” Michael Kugelman, a regional expert at the Woodrow Wilson International Center for Scholars in Washington, told The Post. "Once again a democratically elected prime minister will not serve out a full term, and the political system has suffered a shock, but it will survive. We’ve come a long way since the days of military rule."

Venezuelan police move after an explosion during clashes with anti-government demonstrators in Caracas on Sunday. (Ariana Cubillos/Associated Press)

Thousands of miles away, Venezuela presents a more disturbing example of a society whose institutions are widely distrusted by the public. On Sunday, amid political crisis and economic collapse, the ruling government of President Nicolás Maduro staged an election for a constituent assembly that will draft a new constitution. It was a highly contentious vote, deplored by many in the international community and boycotted by the opposition, which sees the vote as a power grab aimed at supplanting the national legislature dominated by Maduro's foes.

Like so many others in recent months, the day was marked by violence: A pro-government candidate was killed; so, too, were at least ten people in clashes between protesters and police, bringing the death toll in the months-long protest movement to more than 100 people. Polls find that a significant majority of Venezuelans do not approve of the creation of the new body. But while some protesters barricaded streets in Caracas, tens of thousands of state workers went to vote, many out of fear of losing their government-provided benefits.

All of this was sparked by Venezuela's Supreme Court in late March. Stacked with regime loyalists, the court moved to strip the opposition-controlled National Assembly of its powers. The backlash it inspired prompted the court to reverse the decision, but the damage was done. Anger at Maduro's government and the dysfunction it had sowed, including chronic food shortages and a cratering economy, led to nearly daily protests around the country.

Last week, the opposition-controlled National Assembly named 33 magistrates to replace the entire Supreme Court. Now there's the prospect of two parallel legislatures and even two rival Supreme Courts in a country that's steadily coming apart at the seams.

"Today our justice system has been hijacked. It is at the service of the regime," said Congresswoman Sonia Medina at a ceremonial swearing-in of the new magistrates. "The judges have removed themselves from submitting to the rule of law, from the honor of judicial power, to repress, pursue, torture and jail."

Maduro's judges dismissed the stunt and at least two of the selected magistrates were detained by authorities. And the future of democracy in Venezuela grows even dimmer.

Correction: An earlier version of the story mistakenly indicated eight slain protesters were opposed to Maduro. The story has been updated with a number of those killed, sans political affiliation.

Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today's WorldView newsletter.