WASHINGTON — The number of law enforcement officers who died performing their duties in the United States declined by about 23 percent in 2012 after rising the two previous years, a nonprofit organization reported Thursday.
The National Law Enforcement Officers Memorial Fund said in a report that 127 federal, state, and local officers have died in 2012 from injuries suffered on the job. The majority of officers who died were either shot or were victims of traffic accidents, figures show.
Most of the victims were city and county police officers, but the list also includes a prison guard in Indiana who suffered a heart attack while responding to an unruly inmate, a deputy sheriff in Missouri who was fatally shot while responding to an emergency call about an unconscious person, and a Coast Guard officer killed off the California coast while pursuing a vessel suspected of smuggling drugs.
Four Massachusetts law enforcement officers died in the line of duty in 2012, including Officer Peter Kneeland of the Worcester police; Officer Jose Torres of the Westfield police; Officer Kevin Ambrose of the Springfield police; and Norfolk County Deputy Sheriff Ryan Tvelia.
The toll is on pace to be the lowest since 2009, when 122 officers died, and this year would be only the second year since 1960 that the number of fatalities was below 130.
The organization, which also maintains a memorial wall in Washington bearing the names of fallen officers, reported 165 deaths last year and 154 in 2010. The number of deaths topped 200 for most of the 1970s.
The decline is heartening after two straight alarming years and may suggest that police departments, though still battered by budget cuts, are placing a greater emphasis on officer safety, said Craig Floyd, the chairman and chief executive of the Washington, D.C.-based memorial organization.
‘‘I think officers are approaching these potentially life-threatening situations in a more cautious, focused manner,’’ said Floyd, noting the increased prevalence of body armor among officers.
Texas had the highest number of law enforcement fatalities at 10, followed by Georgia (eight) and Colorado and Maryland (six each).
Twelve states and the District of Columbia have not had any officers killed this year.
Thirteen of the officers who died were women.
There have been 49 firearms-related deaths this year, including 15 ambush attacks, as of Thursday.
That’s down from the 72 officers killed by gunfire last year.
The victims include David Gogian and Jeff Atherly, two Topeka, Kan., police officers shot outside a grocery story last week while responding to a report of a suspicious vehicle, and Tom Decker, a police officer in Cold Spring, Minn., and a father of four, who was fatally shot last month in what authorities called an ambush killing.
Traffic-related fatalities, though down from last year, were the leading cause of death — accounting for 50.