Over the last two weeks, the nation has weathered two horrific slayings of police officers, first in Dallas and then in Baton Rouge. In his funeral oration for the slain Dallas officers, President Obama lamented many reasons for the rising "cycle of violence" between law enforcement and minority communities: Poverty, unemployment, underinvestment in schools, lack of rehab programs, easy availability of guns, and more. Meanwhile, after the Baton Rouge ambush, Donald Trump yet again blamed the breakdown of "law and order" in inner cities.

Surely there is at least some truth to all of this. But there's another critical reform to America's criminal justice system that is little talked about, but very important: Hidebound police unions that block elementary transparency and public accountability at every level.

Thanks to America's history of state-enforced slavery and segregation, black communities have rarely trusted the police. But relations have only gotten worse in the age of cell phones, when footage of innocent black men getting shot by police officers, often white, keeps popping up with disturbing regularity. The Ferguson shooting of Michael Brown represented a tipping point that fully launched the Black Lives Matter movement. And the Louisiana and Minnesota shootings this month that triggered the Dallas protests represent a new level of rising frustration and anger.

Conservative police apologists often dismiss this frustration, claiming that police shootings are the result not of bigotry and bias by police but greater black crime rates. And to prove their point they have seized on a study by Harvard University's Roland G. Fryer, black himself, that found no evidence that police are more likely to use lethal force against blacks and Hispanics than whites. (However, the cops are 50 percent more likely to use non-lethal force such as slapping, slamming, and punching against blacks and Hispanics than whites and Asians.)

But Fryer, a careful researcher with a stellar reputation, doesn't have great confidence in his own findings because comprehensive national data about police shootings doesn't exist. His investigation was therefore limited to select areas of Texas, Florida, and Los Angeles that were willing to share their internal records. And this, he acknowledges, introduced a massive self-selection bias in his sample. "These departments only supplied the data because they are either enlightened or were not concerned about what the analysis would reveal," he noted.

So why don't national stats exist? Because America's 18,000 law enforcement agencies don't want them to.

The Crime Control Act of 1994 asked the FBI to annually compile and publish data about the use of police force in all instances so that the country could keep track of trends of police violence, identify problematic precincts, or catch enforcement bias. But union representatives of law enforcement agencies successfully lobbied the feds to make reporting optional. So most departments now simply plead poverty and refuse to comply.

This is a huge problem. In the absence of good data, it is impossible to say definitively if racism is driving police abuse in black communities. And because it is impossible to identify the size and scope of this problem, it is impossible to craft and enact a solution to it — a solution, mind you, that would not only better serve and protect minority communities, but also keep police safer, too.

This is but one example of police unions going to eye-popping lengths to protect rogue cops at the expense of citizens (and the many decent cops who are tainted as well). Consider the binding arbitration that has become a standard feature of virtually all police contracts, which are often negotiated in secrecy. Binding arbitration allows cops to appeal any disciplinary action taken by their superiors to outside arbitrators such as retired judges. In theory, these folks are supposed to be neutral third parties. In reality, they are usually in the pockets of unions and dismiss or roll back a striking two-thirds of all actions, even against cops with a history of abuse and excessive violence. The upshot is that police chiefs are powerless to clean house, even as community complaints pile up. This is exactly what was happening in Baltimore when Freddie Gray died during his ride to the police station last year.

But chiefs aren't the only ones rendered impotent by union contracts. The 1994 federal law gave the Justice Department expanded powers to investigate civil rights abuses in police departments and mandate reforms through agreements called consent decrees. But Justice's prescribed reforms often don't have to be implemented if they conflict with existing union contracts. Last month, the leftist In These Times, usually friendly to public unions, published its investigation of 17 consent decrees that Justice signed between 1997 and 2016. In at least seven of the 17 cases, "collective bargaining agreements presented a major roadblock to implementing them," so that even after Justice concluded its probe, nothing really changed.

Among the special protections that police enjoy that the Justice Department is often powerless to override are rules:

Allowing police departments to destroy civilian complaint records against officers.

Giving cops involved in shootings several days before filing their statements. This gives them crucial time to get their stories straight, in essence turning the notorious "blue code of silence" into official policy.

Barring citizens from filing complaints anonymously and revealing their names to the offending officer. Outrageously, however, names of officers involved in shootings are often withheld from the public. Indeed, The Washington Post reported that last year 210 people were fatally shot by police officers whose identity was never publicly revealed by their departments. This of course means that citizens have to fear retribution if they complain against a rogue cop even as the cop has little fear of being held accountable by citizens.

Police unions have even prevailed on state lawmakers to enshrine some of these protections into law through "Police Bill of Rights" in 14 states.

Police unions insist these special protections are necessary given the inherent dangerousness of their jobs. They often demonize anyone who questions them as "anti cop." (Just ask New York Mayor Bill de Blasio.) But it is inconceivable that any profession that has managed to so insulate itself from elementary checks and balances isn't rife with abuse. And if that's the case, then it would be a miracle for the most vulnerable communities to not be disproportionately affected. That is just how the world works.

Neither President Obama nor Donald Trump are doing anyone any favors by ignoring all of this. There is no hope that Trump will ever speak honestly. But if the president wants to leave a legacy of healing, he ought to forthrightly confront the fact that when those who've been charged with protecting the laws of the country write laws to protect themselves, they endanger everyone — including themselves.