The influence of an inhomogeneous magnetic field on the magnetoresistance of thin Al films, used in different superconductor-ferromagnet hybrids, has been investigated. Two contrasting magnetic textures with out-of-plane magnetization are explored: namely, ͑i͒ a plain film in a multidomain state and ͑ii͒ an array of microsized dots. The stray fields of the ferromagnetic structures confine the superconducting condensate and, accordingly, modify the condition for the nucleation of superconductivity. By switching between different magnetic states of the ferromagnet, this confinement can be tuned at will, thereby reversibly changing the dependence of the critical temperature T c on an external magnetic field H. In particular, continuous evolution from a conventional linear T c ͑H͒ dependence with a single maximum to a reentrant superconducting phase boundary with multiple T c peaks has been demonstrated. The localization of a particle in a restricted volume is known to lead to a discrete energy spectrum due to the particle's wave nature. In some cases the trapping potential can be created artificially in a controlled way ͑e.g., in quantum dots and wells͒, and the geometry-dependent structure of the energy levels provides a convenient way to control the optical and transport properties of such objects. 1 Remarkably, some basic concepts of standard quantum mechanics ͑includ-ing the confinement of the wave function͒ can also be applied to more complicated systems, like superconductors, in which a quantum condensate consisting of paired electrons develops. In this case, the energy of the lowest Landau level, E LLL ͑H͒, where H is the external magnetic field, determines the critical temperature T c ͑H͒ at which superconductivity nucleates. 2 Due to the strong dependence of E LLL ͑H͒ on the imposed confinement, T c ͑H͒ for superconducting microstructures and nanostructures differs significantly from that observed in bulk superconductors. 3 Unfortunately, once this "geometrical" constraint is created, the trapping potential cannot be modified any longer.However, the use of superconductor-ferromagnet ͑S-F͒ hybrids provides an appealing alternative to localize superconducting Cooper pairs. In such S-F hybrids the proximity effect 4 as well as the stray fields of the ferromagnet 5 play an important role in changing the superconducting properties. A magnetic template which creates a nonuniform magnetic field distribution is able to localize the superconducting condensate ͑or normal electrons 6 ͒. Such a modulated field profile can result in exotic shapes of the T c ͑H͒ phase boundary for S-F hybrids, revealing a simple shift of the T c maximum towards a certain magnetic field ͑so called field-induced-superconductivity 7,8 ͒ or a more complicated nonmonotonic T c ͑H͒ dependence with two maxima ͑reen-trant superconductivity 9-11 ͒, and are commonly explained in terms of magnetic field compensation effects. Indeed, for thin superconducting films, placed in a nonuniform magnetic field, superconductivity first nucleates near the ͉B...