The morning after a gunman targeted and killed five law enforcement officers, Dallas Mayor Mike Rawlings called it "ironic" that his city was the target of the worst police loss-of-life since the terrorist attacks on Sept. 11, 2001.

Ironic because the police department says it has taken great strides to avoid the kind of confrontations and incidents that have led to distrust and frayed race relations in some communities. "This police department trained in de-escalation far before cities across America did it," Rawlings told reporters Friday. "We are one of the premier community policing cities in the country."

According to data from the Dallas Police Department, the number of complaints alleging excessive and improper use of force has fallen from 147 in 2009 to 13 through mid-November of 2015.

Even more dramatically, the department reports that the number of shootings involving police went from 23 in 2012 to just one this year (before last night).

There appear to be two reasons for the decline: training and transparency.

Dallas Police training now emphasizes de-escalation, rather than confrontation. Video on the Dallas Morning News website shows so-called "real-life" training: staged scenarios which officers might encounter in the field such as a man waving a weapon.

In the video, Dallas Police Chief David Brown says, "Slowing down, waiting for cover, de-escalating situations we hope will become the new normal for policing in Dallas where we can give ourselves a chance to survive a deadly force confrontation with more cover."

The department has also increased the number of body and dashboard cameras recording police actions. The reasoning is that is likely to cause officers to think about their actions.

But there are important caveats to the department's data, too. There has been no study done showing that the increased training and monitoring has caused the decrease in Dallas police violence, only the correlation.

And it's important to point out that, from 2010 through 2014, Dallas had one of the highest rates of killings by police in the country, when adjusted for population (2.7 per 100,000 residents). That data was published by the Better Government Association, an Illinois watchdog group focusing on Chicago, which had the highest total number of killings during that same period—70.

Even so, very few U.S. police departments have matched Dallas. The White House and the Justice Department praise the Dallas police for being one of 53 jurisdictions participating in the Police Data Initiative, "a community of practice that includes leading law enforcement agencies, technologists, and researchers committed to improving the relationship between citizens and police through uses of data that increase transparency, build community trust, and strengthen accountability."

The Dallas Police website has comprehensive data available to the public, that enables anyone to see how an incident was resolved, what weapon was used, where it happened, even a narrative of each shooting.

Although the suspect in Thursday night's attack told police he was targeting "white people," experts say it's unclear whether he was really targeting the Dallas police in particular.

Norman Stamper, a former Seattle Police Chief who is now writing about police reform, said the attack could have been anywhere a lot of people—and a lot of cops-- were gathered. "He (the shooter) found a large gathering and shot as many people as he could. That's what mass shooters do."

Copyright 2016 NPR. To see more, visit http://www.npr.org/.