We argue that strings (vortices) and monopoles are confined, when fields receiving nontrivial Aharonov-Bohm (AB) phases around a string develop vacuum expectation values (VEVs). We illustrate this in an SU(2)×U(1) gauge theory with charged triplet complex scalar fields admitting Alice strings and monopoles, by introducing charged doublet scalar fields receiving nontrivial AB phases around the Alice string. The Alice string carries a half U(1) magnetic flux and 1/4 SU(2) magnetic flux taking a value in two of the SU(2) generators characterizing the U(1) modulus. This string is not confined in the absence of a doublet VEV in the sense that the SU(2) magnetic flux can be detected at large distance by an AB phase around the string. When the doublet field develops VEVs, there appear two kinds of phases that we call deconfined and confined phases. When a single Alice string is present in the deconfined phase, the U(1) modulus of the string and the vacuum moduli are locked (the bulk-soliton moduli locking). In the confined phase, the Alice string is inevitably attached by a domain wall that we call an AB defect and is confined with an anti-Alice string or another Alice string with the same SU(2) flux. Depending on the partner, the pair annihilates or forms a stable doubly-wound Alice string having an SU(2) magnetic flux inside the core, whose color cannot be detected at large distance by AB phases, implying the “color” confinement. The theory also admits stable Abrikosov-Nielsen-Olesen string and a ℤ2 string in the absence of the doublet VEVs, and each decays into two Alice strings in the presence of the doublet VEVs. A monopole in this theory can be constructed as a closed Alice string with the U(1) modulus twisted once, and we show that with the doublet VEVs, monopoles are also confined to monopole mesons of the monopole charge two.