Once again, a leader of Pakistan has been forced to leave office without completing a full term. On Friday, Nawaz Sharif stepped down as prime minister after the country’s Supreme Court disqualified him on corruption-related charges. For Sharif, this ends a 35-year career in politics that saw him elected prime minister and unceremoniously removed from office three times. For Pakistan, it marks a rare moment of accountability but also raises questions about the future of the country’s flailing democracy: Next year’s general elections will likely see one elected civilian government successfully transfer power to another for only the second time in the country’s history. But no prime ministers voted into power have lasted long enough to defend their records in front of the electorate.

The source of Sharif’s miseries is the release of the so-called Panama Papers last year, in which a consortium of investigative journalists around the world came into the possession of documents from a law firm based in the Central American tax haven. According to the documents, Sharif was one of 12 world leaders in Pakistan whose family or associates were found to own assets stashed offshore but never declared to the Pakistani people. Sharif’s revealed wealth includes companies scattered across continents, luxury apartments in London, and business connections with Persian Gulf royals. Over months of legal proceedings, Sharif faced intense pressure to vacate the prime minister’s hilltop residence in Islamabad.

Sharif was not convicted of corruption, which would have required a criminal trial. He may not face prison time, and will hold on to his allegedly ill-gotten wealth—he has only been forced to leave the office of the prime minister. After the court found that he had not satisfactorily accounted for his wealth, it invoked a vague and overbroad morality clause in the constitution that says leaders must be “truthful” and “trustworthy.” It’s the first time that the clause, introduced during the Islamizing military rule of General Muhammad Zia-ul-Haq, has been used against a holder of public office in Pakistan.

The ruling sets a troubling precedent. Sharif’s most determined opponent is the former cricketer turned politician Imran Khan. From the moment Sharif returned to power in 2013, Khan has been campaigning for his removal, often taking to the streets for weeks of protests. But even Khan has criticized the morality clause in the past, not least when people have tried to use it against him. “Only an angel,” Khan said, could be deemed to meet the clause’s exacting standards.

In Pakistan, politicians have long courted allegations of venality. They never occupy their official residences in Islamabad for long, and yet many of them emerge with suspiciously deep pockets. The arbitrary nature of their rule, long resistant to transparency, gives them control of government contracts, the power to disburse other forms of patronage, and, in the most crude of cases, demand an “administrative fee” for even the most perfunctory pieces of government business. In more recent years, members of parliament, ministers, and other politicians, have become more innovative—using a series of shell companies, frontmen who work through shadowy middlemen, and secret auctions, where bids are privately entertained, before lucrative contracts are announced.

Jahangir Tareen, a reputedly “clean” businessman-turned-politician who has vigorously campaigned for Sharif’s dismissal, last year admitted to indulging in a bit of insider trading. In 2005, while serving as a minister, Tareen took over a rival sugar mill. While the deal was being finalized, he opened trading accounts in the name of his cook and gardener, buying stocks in the sugar mill he was set to acquire. Tareen was ultimately forced to return the profits he earned, but still insists he did nothing wrong.

In 2008, when democracy returned to Pakistan, I interviewed a freshly appointed minister at his office in Islamabad. I had a list of questions about how he was preparing to serve Pakistanis. When I arrived, I found he had already gotten down to business. A queue of supplicants was positioned strategically outside his office door, and ran down the hall. Inside, he was busily signing slips of paper, apparently handing out jobs in exchange for political support. Other ministers arrived, carrying files of their own. Then a member of his party walked through the door, a young woman on each arm. “Sir,” he bellowed, “these are two of my greatest supporters. They’ll make fine air hostesses.”

In Pakistan, everything can be negotiated—the rules are rarely fixed. For the right price, through the right connections, or in return for a favor, you can get things done. Many politicians who enrich themselves rationalize their corrupt practices as somehow serving a noble purpose: they justify their actions on the grounds that they are either helping out their constituents, their party, or even their own family.

Even the biggest fans of politicians don’t deny their leaders’ legendary avarice. Shrugging insouciantly, they say everyone is guilty of acquiring ill-gotten wealth. Their complaint is that it is only democratically elected leaders who are punished. The powerful military has acquired vast wealth of its own. Retired generals often enjoy lives of a splendor their career earnings could never justify, comfortable in the knowledge that they will never be dragged before a court to account for their gilded retirement.

Instead of implementing robust accountability, corruption charges have traditionally been wielded as a tool to weaken civilian leaders and ultimately lever them out of power. During the 1990s, rivals Benazir Bhutto and Nawaz Sharif each served as prime minister for two abbreviated terms. Each time, the dismissal of civilian-led governments was justified on the grounds of corruption.

When Musharraf seized power in the 1999 coup, toppling Sharif’s second government, he famously declared, like dictators before him, that he would cleanse the country of corruption. The narrative he promoted was that grasping politicians were the biggest problem facing the country. Once they were cast aside, the country could embark on a prosperous future. It never happened. Soon after settling into office, he tried to end Sharif and Bhutto’s political careers, but peeled away their supporters to augment his ranks, including those accused of corruption.

Now in exile, having fled charges of high treason for suspending the constitution when he imposed a state of emergency in 2007, Musharraf spoke to the media of his satisfaction with Sharif's resignation. For anyone supportive of Pakistan’s fledgling democracy, it was a brazen show of hypocrisy. Musharraf was never held accountable for the coup that he mounted in 1999 or the other violations of the constitution he committed.

As Musharraf grew unpopular in 2007, supporters of democratic civilian rule were prepared to relax their standards when it came to choosing their next leaders. Other than the established political parties, there were no other vehicles to realize their democratic aspirations. Even Asif Zardari, a man once known as “Mr. 10%” for the kickbacks he allegedly favored on government contracts, became acceptable as a face of democracy. But over time, patience has worn thin. In an overwhelmingly young country, where a new generation fears for its own prospects, there is a deepening resentment of what they see as inept, distant, and venal elites.

The Supreme Court decision has, so far, proven wildly popular in Pakistan. At a mall in Peshawar, a group of men broke into a traditional dance against the backdrop of Pashto music. Sweets are thrust into the mouths of exultant opposition politicians as the cameras look on. Social media is aglow with young Pakistanis thrilled by the sight of a powerful politician brought low. But it is far from clear whether Sharif’s exit inaugurates an era of accountability and transparency in Pakistan, or reflects the persistence of an age where corruption charges are selectively applied and only unelected and unaccountable institutions decide the fate of the country’s rulers.