Information processing in the cortex is nonlinear, a property essential to the computations performed by the brain. This nonlinearity, at least in some visual areas, takes the form of gain control by divisive inhibition, a.k.a. Heeger's normalization. We explore the statistical properties of this normalization in the presence of noise. Using simulations, we show that Heeger's normalization is a close approximation to a maximum likelihood estimator, which, in the context of population coding, is equivalent to an ideal observer. We also demonstrate analytically that this is a general property of a large class of nonlinear recurrent networks with M-dimensional attractors. Our work suggests that Heeger's normalization plays a critical role in noise filtering, and that every cortical layer may be an ideal observer of the activity in the preceding layer.