The appearance of mathematical regularities in the disposition of leaves on a stem, scales on a pine-cone, and spines on a cactus has puzzled scholars for millennia; similar so-called phyllotactic patterns are seen in self-organized growth, polypeptides, convection, magnetic flux lattices and ion beams. Levitov showed that a cylindrical lattice of repulsive particles can reproduce phyllotaxis under the (unproved) assumption that minimum of energy would be achieved by two-dimensional Bravais lattices. Here we provide experimental and numerical evidence that the Phyllotactic lattice is actually a ground state. When mechanically annealed, our experimental "magnetic cactus" precisely reproduces botanical phyllotaxis, along with domain boundaries (called transitions in Botany) between different phyllotactic patterns. We employ a structural genetic algorithm to explore the more general axially unconstrained case, which reveals multijugate (multiple spirals) as well as monojugate (single-spiral) phyllotaxis.