Helioseismic measurements indicate that the solar tachocline is very thin, its full thickness not exceeding 4% of the solar radius. The mechanism that inhibits differential rotation to propagate from the convective zone to deeper into the radiative zone is not known, though several propositions have been made. In this paper we demonstrate by numerical models and analytic estimates that the tachocline can be confined to its observed thickness by a poloidal magnetic field B_p of about one kilogauss, penetrating below the convective zone and oscillating with a period of 22 years, if the tachocline region is turbulent with a diffusivity of eta 10^10 cm^2/s (for a turbulent magnetic Prandtl number of unity). We also show that a similar confinement may be produced for other pairs of the parameter values (B_p, eta). The assumption of the dynamo field penetrating into the tachocline is consistent whenever eta>10^9 cm^2/s.