We prove that any connected 2-compact group is classified by its 2-adic root datum, and in particular the exotic 2-compact group DI(4), constructed by Dwyer-Wilkerson, is the only simple 2-compact group not arising as the 2-completion of a compact connected Lie group. Combined with our earlier work with Moeller and Viruel for p odd, this establishes the full classification of p-compact groups, stating that, up to isomorphism, there is a one-to-one correspondence between connected p-compact groups and root data over the p-adic integers. As a consequence we prove the maximal torus conjecture, giving a one-to-one correspondence between compact Lie groups and finite loop spaces admitting a maximal torus. Our proof is a general induction on the dimension of the group, which works for all primes. It refines the Andersen-Grodal-Moeller-Viruel methods to incorporate the theory of root data over the p-adic integers, as developed by Dwyer-Wilkerson and the authors, and we show that certain occurring obstructions vanish, by relating them to obstruction groups calculated by Jackowski-McClure-Oliver in the early 1990s.