  In this paper we prove the following long-standing conjecture: stable
solutions to semilinear elliptic equations are bounded (and thus smooth) in
dimension $n \leq 9$.
  This result, that was only known to be true for $n\leq4$, is optimal:
$\log(1/|x|^2)$ is a $W^{1,2}$ singular stable solution for $n\geq10$.
  The proof of this conjecture is a consequence of a new universal estimate: we
prove that, in dimension $n \leq 9$, stable solutions are bounded in terms only
of their $L^1$ norm, independently of the nonlinearity. In addition, in every
dimension we establish a higher integrability result for the gradient and
optimal integrability results for the solution in Morrey spaces.
  As one can see by a series of classical examples, all our results are sharp.
Furthermore, as a corollary we obtain that extremal solutions of Gelfand
problems are $W^{1,2}$ in every dimension and they are smooth in dimension $n
\leq 9$. This answers to two famous open problems posed by Brezis and
Brezis-V\'azquez.
