When a former student opened fire on pupils and teachers last week at Marjory Stoneman Douglas High School, school resource officer Scot Peterson was on duty. He was armed. He was at the school. Yet as security video released after the shooting that killed 17 people showed, he did not engage the shooter. It was one of a series of failures at various levels of government that allowed the shooter to carry out the heinous act.

Peterson, who resigned last week, he is likely to receive an annual pension of at least $52,000—and the actual total is likely higher, potentially close to $70,000. In addition, half his health insurance premiums will be covered by taxpayers.*

If he lives to be 78, the average life expectancy for a man in Broward County, the currently 54-year-old Peterson stands to collect more than $1.24 million from Florida's public pension system.

Understanding Peterson's specific situation helps shed light on the broader implications of public retirement costs in Florida and around the country. An employee like Peterson, who was by all accounts a typical deputy in the sprawling Broward County Sheriff's Office (BCSO) before his unfortunate rise to national prominence this month, is afforded a retirement package that kicks in at age 52 and allows him to collect a pension even if he pursues other work after his retirement. It's vastly different from what most private sector workers can expect to receive. The difference is premised on the idea that Peterson put his life on the line in a high-risk profession.

The payouts are virtually guaranteed, regardless of performance in the line of duty. Under state law, pensions can be forfeited only after a conviction for a narrowly defined list of crimes.

Determining Peterson's pension requires a bit of guesswork, since his first pension check won't be cut by the Florida Retirement System for at least another month, and potentially longer if the BCSO tries to hold up those payments while its investigation into Peterson continues.

Here's how I arrived at my numbers, which are based on publicly available information about Peterson, news accounts of his resignation, and interviews with Jim Bell, president of the union that represents members of the BCSO, and Leonard Gilroy, director of the pension integrity project for the Reason Foundation (which publishes this blog).

Peterson earned $75,673 in 2016, according to public records data obtained by the Sun-Sentinel. He had been working as the school resource officer at Marjory Stoneman Douglas High School since 2009, and he had been an employee of the Broward County Sheriff's Office since 1985, according to documents released by the sheriff's office after Peterson's resignation.

That means Peterson put in at least 25 years at the BCSO, an important threshold for accruing pension benefits under Florida law.

The pensions afforded to Florida's sheriffs are based on a calculation that starts with an average of the employee's five highest-paid years. That average is then multiplied by a percentage that varies based on how many years an employee has worked and at what job.

Law enforcement employees and other public employees in so-called "high-risk" positions earn a multiplier of 3 percent for every year worked. (Other public workers earn a lower multiplier, usually 2 percent.) After 25 years of service, for example, a law enforcement employee like Peterson would have earned a pension equal to 75 percent of the average of his five highest-paid years during his final 10 years of employment. Under Florida law, pension payouts are capped at 100 percent of this figure, which is known as a "final annual salary."

"The pension benefit for first responders in the Florida Retirement System is generally consistent with other public safety systems across the country," says Gilroy. "Using 'high-5' for the final average salary calculation is common too, and the overall benefit cap is designed to keep benefit accruals in check."

Peterson's earnings in other years remain unknown, but he'd spent at least nine years as a school resource officer and there's nothing to suggest that 2016 was anything other than an average year for him. Assuming he'd eared slightly less in previous years (to allow for annual pay increases), we can safely project that Peterson earned around $70,000 on average during the last five years of his career with the BCSO.

With at least 25 years of service time, Peterson would qualify for a pension equal to 75 percent of this final annual salary—or $52,500.

This is the most conservative estimate of Peterson's pension, which fails to take into account several factors likely to boost his eventual payout.

For starters, Peterson had worked more than 25 years for the BCSO. Still, the 25-year figure is important because it means that Peterson was fully vested in the pension system when he retired last Thursday and could immediately begin drawing a pension.

After 25 years of service, Peterson could have continued to accrue pension benefits in the same manner as before. In that case, his 32 years of service would qualify him for a pension of about $67,000 annually (assuming a $70,000 final average salary and a 3 percent multiplier with 32 years of service).

Alternatively, Peterson could have enrolled in a so-called DROP (Deferred Retirement Option Plan) program after 25 years with the BCSO. If so, his retirement benefit would have been capped when he entered the DROP program—capped, therefore, at 75 percent if he'd entered in the first year he was eligible—but he would be able to collect, at retirement, a lump sum payment equal to the contributions he deferred while continuing to work.

Opting into a DROP program can increase or decrease the amount of retirement benefits paid to a public employee, depending on a number of factors, such as how long the employee lives after retiring. (DROP program recipients get a bigger payout up front and relatively smaller monthly amounts.) Still, they wouldn't exist if they weren't beneficial to the retirees—and the number of cities, including Dallas and Philadelphia, that have been financially stressed by DROP programs should indicate which side usually benefits from them.

Regardless of whether Peterson used the DROP program or not, he could have padded his pension payout with other bonuses that factor into the calculation of a "final average salary," thus inflating the rest of the pension calculation. In 2016, for example, Peterson's salary of $75,643 was boosted to a final total of $101,000 with overtime and other bonuses, according to the Sun-Sentinel.

It's also possible that Peterson was enrolled in Florida's relatively new 401(k)-style retirement program, which would make it virtually impossible to determine how much his retirement benefits will be. Gilroy believes it's unlikely that an employee who had been with the BCSO since the 1980s would be enrolled in anything other than the traditional pension plan. Florida passed a law in 2017 to automatically enroll most new hires in the 401(k)-style program, which shields taxpayers from excessive pension costs, but law enforcement employees were exempted from that provision and continue to be enrolled in the old pension system unless they choose otherwise.

Bell, the union president, says he encourages new hires to opt into the traditional pension. He did not know which plan Peterson was using.

In either pension system, Peterson will be eligible to have half his medical expenses covered for the rest of his life.

"If you leave the agency in good standing after 25 years of service here," says Bell, "the sheriff's office will pay 50 percent of your health benefits for the rest of your life."

Could Peterson lose his pension as a result of his botched response to the school shooting? That seems unlikely. Under Florida law, public pensions can be revoked for felony offenses that "breach the public trust." The specific crimes on the list are related to embezzlement, theft, bribery, and child sexual assault only.

Bell says the sheriff's office could hold up pension payments because of the pending investigation into Peterson's conduct.

"But at the end of the day, there's really nothing they can do to take those benefits," Bell says, "because he's already resigned."

*CORRECTION: This post originally stated that half of Peterson medical expenses will be covered by taxpayers. It has been updated to clarify that 50 percent of Peterson's health insurance premiums will be covered by taxpayers, per the terms of a collective bargaining agreement.