Powerful 'space weather' events caused by solar activity pose serious risks to human health, safety, economic activity and national security. Spikes in deaths due to heart attacks, strokes and other diseases occurred during prolonged power outages. Currently it is hard to prepare for and mitigate the impact of space weather because it is impossible to forecast the solar eruptions that can cause these terrestrial events until they are seen on the Sun. However, as recently reported in Nature, eruptive events like coronal mass ejections and solar flares, are organized into quasi-periodic "seasons", which include enhanced bursts of eruptions for several months, followed by quiet periods. We explored the dynamics of sunspot-producing magnetic fields and discovered for the first time that bursty and quiet seasons, manifested in surface magnetic structures, can be caused by quasi-periodic energy-exchange among magnetic fields, Rossby waves and differential rotation of the solar interior shear-layer (called tachocline). Our results for the first time provide a quantitative physical mechanism for forecasting the strength and duration of bursty seasons several months in advance, which can greatly enhance our ability to warn humans about dangerous solar bursts and prevent damage to satellites and power stations from space weather events.