In typical debates about freedom, compatibilists and incompatibilists dispute whether and how one can defuse the threat that a naturalistic worldview seems to pose for our conception of free will. Proponents of both sides standardly take it for granted that natural causality is a potential threat only for practical deliberation, and that no corresponding worries arise for our self-conception as theorizers who make up their mind about what to believe about the world. I show that Kant rejects this standard dichotomy between practice and theory. He holds that we must both act and believe 'under the idea of freedom': the standpoint of theoretical reasoning, the very source of the naturalistic worldview, must itself rely on the idea of freedom (or spontaneity) and thus cannot expose free will as an illusion. This line of thought, I argue, casts a refreshing new light on debates about what kind of freedom is worth having; and it provides an intriguing defense of our freedom from natural necessity.I argue that Kant's conception of theoretical freedom is as anti-naturalistic as his conception of practical freedom. This twofold anti-naturalism derives from Kant's conviction that both our practical and our epistemic orientation depend on representations that we cannot attribute to natural causes without losing our grip on their objective validity. These include, in the practical case, the categorical imperative and, in the theoretical case, the principle of sufficient reason, which states that natural events are causally necessitated. Since we do not derive these representations from sense perception, our commitment to them must, within a wholly naturalistic framework, be traced to the influence of contingent psychological processes in the vein of Hume's 'customs'. The concession that our attitudes are the product of such customs challenges our conviction that we form these attitudes on the basis of objective reasons.Against prevailing interpretations, I show that this line of thought plays an indispensable role in Kant's defense of free will against attacks from the theoretical standpoint. Kant's point is that someone occupying this standpoint must rely on her cognitive freedom from natural necessity: that is, she must take her beliefs about the natural causes of actions to be responsive to objective theoretical reasons, and here she cannot concede that the representation of causal necessity is merely the product of the workings of non-rational psychological processes. So the naturalistic perspective cannot expose freedom as an illusion. This provides the idea of free will with a robust invulnerability against an exclusively naturalistic worldview.