Let $G = (G,+)$ be a compact connected abelian group, and let $\mu _G$ denote its probability Haar measure. A theorem of Kneser (generalising previous results of Macbeath, Raikov, and Shields) establishes the bound $\mu _G(A + B) \geq \min (\mu _G(A)+\mu _G(B),1)$ whenever $A$ and $B$ are compact subsets of $G$, and $A+B := \{a+b: a \in A,\, b \in B\}$ denotes the sumset of $A$ and $B$. Clearly one has equality when $\mu _G(A)+\mu _G(B) \geq 1$. Another way in which equality can be obtained is when $A = \phi ^{-1}(I)$ and $B = \phi ^{-1}(J)$ for some continuous surjective homomorphism $\phi : G \to \mathbb{R} /\mathbb{Z} $ and compact arcs $I,J \subset \mathbb{R} /\mathbb{Z} $. We establish an inverse theorem that asserts, roughly speaking, that when equality in the above bound is almost attained, then $A$ and $B$ are close to one of the above examples. We also give a more “robust” form of this theorem in which the sumset $A+B$ is replaced by the partial sumset $A +_{\varepsilon} B := \{1_A * 1_B \geq \varepsilon \}$ for some small $\varepsilon >0$. In a subsequent paper with Joni Teräväinen, we will apply this latter inverse theorem to establish that certain patterns in multiplicative functions occur with positive density.