Detroit's bankruptcy and the problems facing its pension funds offer two important lessons to other communities. One is that state and local governments need to do a much better job managing retirement funds. The other is that they should not pre-emptively reduce hard-earned benefits at the first sign of trouble.

Several state and local pension systems around the country are under serious stress. Not surprisingly, the hardest hit retirement funds are in places devastated by global economic forces like Detroit, as well as inland cities in California like Stockton, which was battered by the real estate collapse and has also sought bankruptcy protection. Other troubled funds include state-employee and teacher retirement systems in Illinois and Connecticut, where government officials have long mismanaged public finances.

The biggest problem is that officials have repeatedly failed to set aside enough money to cover the benefits they have promised workers, according to a recent report by Moody's, the credit ratings firm. Some states and cities have compounded their problems by trying to compensate with risky bets, like investing heavily in hedge funds in hopes of earning high returns. (And hedge funds are hardly surefire winners.) Or, like Detroit, they borrowed money to sustain their pension systems without having a solid plan for repaying the new debt.

Avoiding a Detroit-like downward spiral requires discipline and intelligence. Most urgent, officials overseeing troubled funds need to save more money. They also should leave investment choices to seasoned professional managers. In some cases they might have no choice but to reduce benefits, which shouldn't happen before other creditors are asked to take a haircut and before consulting with workers and retirees.

Most government retirement systems are in much better shape than critics suggest. While many pension funds suffered losses during the financial crisis, they should be able to pay out benefits to retirees as long as governments keep funding them adequately and the economy continues to recover. Some lawmakers like Sen. Orrin Hatch, R-Utah, have suggested that cities and states reduce benefits for retirees or force them into riskier and more expensive retirement options including annuities and 401(k) plans. That would be the wrong lesson to learn from Detroit.

All states and cities - and not just those facing imminent crisis - would do well to examine a promising approach to pension management recently adopted by the Canadian province of New Brunswick with the support of the province's labor unions.

New Brunswick's approach splits benefits for retirees into two tiers: base and ancillary. The idea is to guarantee basic benefits and allow ancillary benefits (like cost of living adjustments) to fluctuate based on the health of the pension fund. If a fund's investments fall too much, the government kicks in more money and retirees do not get some of the ancillary benefits. If it does better than expected, employers recoup some of their earlier contributions and workers get bigger monthly pension checks.

State and local officials have little control over the global economy, but they can still do a lot to protect their taxpayers and employees from financial disasters.