Let Γ be a lattice in SO0(n,1). We prove that if the associated locally symmetric space contains infinitely many maximal totally geodesic subspaces of dimension at least 2, then Γ is arithmetic. This answers a question of Reid for hyperbolic n-manifolds and, independently, McMullen for hyperbolic 3-manifolds. We prove these results by proving a superrigidity theorem for certain representations of such lattices. The proof of our superrigidity theorem uses results on equidistribution from homogeneous dynamics and our main result also admits a formulation in that language.