Understanding the Sun's magnetic activity is important because of its impact on the Earth's environment. The sunspot record since 1610 shows irregular 11-year cycles of activity; they are modulated on longer timescales and were interrupted by the Maunder minimum in the 17th century. Future behavior cannot easily be predicted – even in the short-term. Recent activity has been abnormally high for at least 8 cycles: is this grand maximum likely to terminate soon or even to be followed by another (Maunder-like) grand minimum? To answer these questions we use, as a measure of the Sun's open magnetic field, a composite record of the solar modulation function Φ, reconstructed principally from the proxy record of cosmogenic 10Be abundances in the GRIP icecore from Greenland. This Φ record extends back for almost 10,000 years, showing many grand maxima and grand minima (defined as intervals when Φ is within the top or bottom 20% of a Gaussian distribution). We carry out a statistical analysis of this record and calculate the life expectancy of the current grand maximum. We find that it is only expected to last for a further 15–36 years, with the more reliable methods yielding shorter expectancies, and we therefore predict a decline in solar activity within the next two or three cycles. We are not able, however, to predict the level of the ensuing minimum.