In recent years, the principle of legality has received renewed focus in recent years. In this paper, I argue that because the principle of legality is a tool for working out what the law is, any theory that seeks to justify or censure the principle must include a further theory about what makes the law what it is. In other words, it must be premised on a theory of general jurisprudence. The theory of general jurisprudence that makes the best sense of the principle of legality, I argue, is an anti-positivist one that views legal rights as genuine moral rights. More specifically, I argue that the principle of legality is best explained and justified with reference to Ronald Dworkin’s principle of ‘integrity’. This account explains and justifies key features of the principle of legality that other theories struggle to account for, and can act as a roadmap for its future development.