  We consider an SU(2) gauge theory in six-dimensions. We show that there
exists non-trivial structure of gauge vacua in compactified background M4xS2.
In this circumstances, there can exist a cosmic string, whose solution is
recently constructed by the present authors. We consider the stage of the
formation of the strings, i.e., the phase transition of the gauge configuration
on the sphere in the `hot' early universe. We find that if SU(2)-doublet
fermions are the dominant component of the radiation at high temperatures, the
phase transition successively occurs after the spontaneous-compactification
transition. Otherwise, non-trivial vacuum with `monopole' configuration of the
SU(2) gauge field never appears globally and strings must be formed at the same
time as the extra space is compactified.
