Let Ω⊂Rn+1 be an open set with n-AD-regular boundary. In this paper we prove that if the harmonic measure for Ω satisfies the so-called weak-A∞ condition, then Ω satisfies a suitable connectivity condition, namely the weak local John condition. Together with other previous results by Hofmann and Martell, this implies that the weak-A∞ condition for harmonic measure holds if and only if ∂Ω is uniformly n-rectifiable and the weak local John condition is satisfied. This yields the first geometric characterization of the weak-A∞ condition for harmonic measure, which is important because of its connection with the Dirichlet problem for the Laplace equation.