The 11-year cycle of solar activity follows Hale's law by reversing the magnetic polarity of leading and following sunspots in bipolar regions during the minima of activity. In the 1996-97 solar minimum, most solar activity emerged in narrow longitudinal zones - `active longitudes' but over a range in latitude. Investigating the distribution of solar magnetic flux, we have found that the Hale sunspot polarity reversal first occurred in these active zones. We have estimated the rotation rates of the magnetic flux in the active zones before and after the polarity reversal. Comparing these rotation rates with the internal rotation inferred by helioseismology, we suggest that both `old' and `new' magnetic fluxes were probably generated in a low-latitude zone near the base of the solar convection zone. The reversal of active region polarity observed in certain longitudes at the beginning of a new solar cycle suggests that the phenomenon of active longitudes may give fundamental information about the mechanism of the solar cycle. The non-random distribution of old-cycle and new-cycle fluxes presents a challenge for dynamo theories, most of which assume a uniform longitudinal distribution of solar magnetic fields.