When Sonny Khoo in November retired at age 50 from the Contra Costa hazardous materials team, he had worked 22½ years for the county. His final salary was $94,255 a year. His starting annual retirement pay was $126,688.

Khoo spiked his pension by volunteering for extra after-hours on-call shifts during his final year. County health director Bill Walker says the department was short-staffed and needed Khoo to sign up.

But records show this pension boosting has been going on for years. All eight hazardous materials specialists who retired since 2008 signed up for far more on-call hours in their final year than they had in each of the previous two. In some cases, the workers had rarely, if ever, previously volunteered.

The pension spike is probably illegal because income from voluntary overtime shifts should not be counted in pension calculations. But the Contra Costa Employees' Retirement Association, which administers the county's pension system, has been including it for years.

The spike would also be barred under a new state law Gov. Jerry Brown signed last year. Employee groups from Contra Costa, Alameda, Marin and Merced counties have sued, and a Superior Court judge in Martinez has blocked implementation while the case is pending.

The law was designed to halt some of the worst spiking, making retirement boards in the four counties, especially Contra Costa, obey past laws and court interpretations. The biggest abuse previously identified was the inappropriate counting in pension calculations of payments for unused vacation time.

While trying to determine the magnitude of that vacation spike in Contra Costa, I requested county payroll data that also revealed the on-call salary boost. For the hazardous materials specialists, the on-call income provides a much bigger spike than unused vacation payouts.

"They're taking advantage of the system, but the system is set up to allow that," says Randy Sawyer, the county's chief hazardous materials officer. That's right. The system does allow it, but he and Walker are part of that system -- and they have little concern about, or understanding of, the long-term liabilities this scam creates.

Here's how it works. The county needs hazardous materials experts on call at all times in case of a spill or refinery release. For every four hours workers are on call they collect an hour's pay. Not all qualified employees sign up. However, those nearing retirement eagerly do.

In Khoo's case, he volunteered in his final 12 months for more than 4,800 hours of on-call duty, collecting more than 1,200 hours of additional salary. That was more than twice as many on-call hours as he had worked the prior 12 months. In his final month before retirement, he was on call almost every hour that he wasn't at work.

The on-call pay added about $53,500 to his final year's income. It was all counted by the retirement board in his pension calculation. He also received credit for $15,376 of unused leave time, another credit banned under past court decisions and the new state law. Other pay differentials and his base salary bring his final year's income used for the pension calculation to $183,234.

Khoo was entitled to the same generous pension formula that most police and firefighters receive, 3 percent of salary for every year on the job. And his service credit time was boosted by a half year of unused sick leave.

Multiply the 23.0466 years of service, the $183,234 final year's income and the 3 percent factor and it works out to a starting annual pension of $126,687. That amount will be increased each year for inflation.

If the pension system had excluded on-call pay, unused leave time and other add-ons barred under past court decisions and the new state law, Khoo's pension would have started at about $72,000 a year.

Assuming he lives an average life, the difference between his pension and what it would have been under the new state law is about $900,000 in today's dollars.

Almost all that additional cost falls to taxpayers. While Contra Costa workers make significant pension contributions, they pay nearly nothing toward the questionable items.

It's a sweet deal.

Daniel Borenstein is a staff columnist and editorial writer. Contact him at 925-943-8248 or dborenstein@bayareanewsgroup.com. Follow him at Twitter.com/borensteindan.