  Let $(X,B)$ be a pair, and let $f \colon X \rightarrow S$ be a contraction
with $-(K_X + B)$ nef over $S$. A conjecture, known as the Shokurov-Koll\'{a}r
connectedness principle, predicts that $f^{-1} (s) \cap \mathrm{Nklt}(X,B)$ has
at most two connected components, where $s \in S$ is an arbitrary schematic
point and $\mathrm{Nklt}(X,B)$ denotes the non-klt locus of $(X,B)$. In this
work, we prove this conjecture, characterizing those cases in which
$\mathrm{Nklt}(X,B)$ fails to be connected, and we extend these same results
also to the category of generalized pairs. Finally, we apply these results and
the techniques to the study of the dual complex for generalized log Calabi-Yau
pairs, generalizing results of Koll\'{a}r-Xu and Nakamura.
