In almost every corner of Pakistan, anger at the ruling elite is nearing a boiling point.

Thousands have protested soaring electricity bills just outside the capital, Islamabad. In a major port city in the southwest, dozens have clashed with security officers over what they described as forced disappearances of activists. In the northwest, protesters have admonished the country’s generals for a recent surge in terrorist attacks.

The demonstrations over the past few weeks reflect frustration with Pakistan’s shaky, five-month-old government and with its military, the country’s ultimate authority. The unrest threatens to plunge Pakistan back into the depths of political turmoil that has flared in recent years and that many had hoped would subside after the February general election.

Pakistan’s leaders are confronted with a monsoon of problems. The economy is suffering its worst crisis in decades. Anger at an election widely viewed as manipulated by the military remains palpable. Militant violence has roared back after the Taliban’s return to power in neighboring Afghanistan. And Pakistani politics are more polarized than ever, with the country’s most popular political figure sitting in jail after a bitter rift with the military.

The administration of the current prime minister, Shehbaz Sharif, has struggled to establish its legitimacy and has been criticized as little more than a front for the military.

Since Mr. Sharif first came into office in 2022, Pakistan’s generals have wielded an increasingly heavy hand to quash dissent. A national firewall has been installed to censor internet content, the social media platform X has been blocked, security forces have arrested political opponents in droves, and generals have been installed in key positions in the civilian government.