The long-ruling president of Burkina Faso, Blaise Compaoré, was corrupt, exclusionary and increasingly autocratic before his abrupt fall from power late last month. But he did have the law on his side in his showdown with the street demonstrators who ultimately pushed him from office — and that fact reveals flaws in African democracy that affect the lives of hundreds of millions of people across the continent.

Legally, the protesters did not have much to stand on. Not only did the president’s attempt to extend his term in office by changing the Constitution follow legal procedures, but his decision late last month to renounce that effort and promise to resign at the end of his mandate in November 2015 seemed to address the demonstrators’ original concerns. Still, they wanted him out. Now.

The larger issue in Burkina Faso, as elsewhere in Africa, is that formally democratic rules can easily be applied to perpetuate the authoritarian domination of a ruling clique. People might vote and parliament might convene, follow procedure and pass laws, but it is a largely hidden network of patronage alliances and security agencies that actually rules. This system excludes large segments of society from the benefits of genuine representation and produces vast inequalities mediated though access to state resources and offices. It breeds grievances, alienation and anger, which the burning down of Burkina Faso’s Parliament by demonstrators illustrates only too well.

Mr. Compaoré took power in 1987 in a coup that saw the killing of his “friend” Thomas Sankara in a crime never accounted for. For all the normalization and economic reforms he brought about, and despite his growing reputation as an agent of stability, his mediations of regional conflicts, and his willingness to support America’s local anti-terror efforts, he developed an increasingly authoritarian regime shrouded in democratic trappings.