Abstract: Classical constitutional theory identified three functions of government—law-making, law enforcement, and adjudication of legal disputes—and assigned them to three distinct branches of government. As this tripartite framework began to break down over the course of the twentieth century, constitutional theorists identified a fourth function—the protection of the constitution itself. The corruption of high-level public officials can undermine democracy, in large part by generating public cynicism about the possibility that government can act for the general good. In principle, a structurally independent institution suggests itself as the solution, such as electoral commissions and anti-corruption institutions. This paper presents two case studies of institutions supporting democracy in South Africa and Brazil. It suggests that those who design these institutions, and those who staff them, should be sensitive to the complicated interactions between independence, necessary to ensure that high-level corruption comes under scrutiny, and accountability, necessary to ensure that anti-corruption investigations are well-integrated into the nation's system of government as a whole.