  After summarizing the relevant observational data, we discuss how a study of
flux tube dynamics in the solar convection zone helps us to understand the
formation of sunspots. Then we introduce the flux transport dynamo model and
assess its success in modelling both the solar cycle and its departures from
strictly periodic behaviour.
