It’s the demography, stupid.

There are a lot of different reasons this is turning out to be such a politically hot summer in so much of the Western world. But one way to understand this season’s acrimony — from the protests of the indignati in Spain and Greece, to the budget deadlock in Washington and even to the tragedy in Norway — is as diverse symptoms of a shared condition: The West is getting old. That demographic fact is becoming a generational war, and there is every reason to believe that in the coming decades it will get worse.

The heart of the problem is arithmetical: The post-World War II social welfare state, created at a moment when the baby boom was still gestating, is built on a generational Ponzi scheme. As life expectancy increases and fertility declines, that population pyramid is being inverted — and in some countries, that is causing the entire economy to topple.

That’s true in Greece and Spain, where the young are taking to the streets partly because state pension commitments have become so heavy they are suffocating the economy and depriving the seniors’ grandchildren of any chance of a job. Likewise in the United States, where, notwithstanding the national self-image as a laissez-faire land that has eschewed Europe’s lavish social safety net, the budget battle is really a fight about the old: Programs for the elderly constitute almost half of non-interest government spending, about $1.6 trillion in 2010, of a $3.3 trillion total. That figure will swell as the baby boomers retire.

According to a paper by political economist Nicholas Eberstadt, who has done extensive research on the issue, “costs associated with population aging are estimated to account for about half the public-debt run-up of the O.E.C.D. economies over the past 20 years.”

It is not just at home that graying societies are creating wrenching political and economic tensions: The demographic squeeze may be contributing to one of today’s biggest dangers in international finance: the threat of sovereign default. Ali Alichi, an economist at the International Monetary Fund, argues in an essay published by the fund last month that “old folks may be less willing to repay sovereign debt.” According to Alichi, “As the number of older voters relative to younger ones increases around the globe, the creditworthiness of borrowing countries could decline — resulting in less external lending and more sovereign debt defaults.”