  It has previously been found that a magnetic impurity in a conventional
$s$-wave superconductor can give rise to a local $\pi$-phase shift of the
superconducting order parameter. By studying a finite wire of ferromagnetic
impurities, we are able to trace the origin of the $\pi$-phase shift to a
resonance condition for the Bogoliubov-de Gennes quasiparticle states. When
non-resonating states localized at the impurity sites are pulled into the
condensate for increasing magnetic strength, the superconducting order
parameter is reduced in discrete steps, eventually resulting in a $\pi$-phase
shift. We also show that for a finite spin-orbit coupling, the $\pi$-phase
shift is preserved and occurs in a large portion of the topologically
non-trivial phase.
