Officers investigate a homicide in California on Oct. 6. (Robert Tong/AP)

Danielle Allen is a political theorist at Harvard University and a contributing columnist for The Post.

To argue for legalization of marijuana and decriminalization of other drugs does not, at first blush, appear to put one on the side of the angels, especially given the accelerating heroin epidemic. But legalization and decriminalization are what we need if we want to make headway against mass incarceration, high homicide rates in urban black communities and poor educational outcomes in urban schools. If we view drug use as a public health problem, not a crime, we can fight drugs without producing the other sorts of social damage we see all around us.

Americans from all racial groups pursue narcotic-related leisure activities, spending an estimated $100 billion a year on their illegal drugs, according to a report from the White House Office of National Drug Control Policy. In this current period of fairly active military engagement, the nation’s defense budget is roughly $600 billion. In other words, our culture of illegal drug use must be pretty important to amount to a full sixth of our budget for national defense.

Yet despite this evidence of far-reaching social acceptance of illegal drug use, we continue to lock up nonviolent offenders. Ceasing this hypocritical practice by releasing nonviolent offenders is morally urgent. Yet this would be only a small step toward rectification of the problem of mass incarceration. As the Web site FiveThirtyEight recently reported, such a move would reduce our state and federal prison populations by only about 14 percent. We would still be the world’s leading imprisoner.

The further-reaching reason to legalize marijuana and decriminalize other drugs flows from how the war on drugs drives violent crime, which in turn pushes up incarceration and generates other negative social outcomes. You just can’t move $100 billion worth of illegal product without a lot of assault and homicide. This should not be a hard point to see or make. Criminologists and law enforcement personnel alike acknowledge that the most common examples of “criminogenic trends” that generate increases in murder and other violent crimes are gang- and drug-related homicides.

But there is also another, more subtle connection between the drug war and violence, pinpointed by economists Brendan O’Flaherty and Rajiv Sethi . As they argue, above-average homicide rates will result from low rates of successful investigation and prosecution of homicide cases. If you live in an environment where you know that someone can shoot you with impunity, you are much more likely to be ready to shoot to kill at the first sign of danger. When murder goes unpunished, it begets more murder, partly for purposes of retaliation, partly because people are emboldened by lawlessness, but also as a matter of preemption. Unpunished murder makes everyone (including police) trigger-happy. Such places operate according to the dictum that the best defense is a strong offense.

Major urban centers of the drug trade are just such environments, plagued by low clearance rates for homicide. In Detroit, in the years approaching the city’s bankruptcy, the homicide clearance rate verged on single digits. In Chicago, in 2009, police cleared only 30 percent of homicide cases, many of them without charges. In one Los Angeles Police Department bureau, clearance rates in the 60s mask the low rate of cases ending in arrest and prosecution. And clearance rates are lowest when victims are black and brown, as Jill Leovy explains in her new book, “Ghettoside.” In contrast, in the 1960s, in the United States, the average clearance rate for homicide was above 90 percent, according to NPR.

Why have homicide clearance rates fallen so low in these cities? According to criminologist Charles Wellford, drug-related homicides are harder to investigate, possibly because they are more likely to be stranger-to-stranger incidents and possibly because the drug business generates witness-suppression systems. Additionally, stop-and-frisk tactics have eroded trust in police and further diminished the willingness of witnesses to testify. And, recently, justified anger over police violence has further reduced the capacity of the police to function well in investigating homicides.

Finally, an overloaded judicial system may well put prosecutors in a position where they wish to pursue only open-and-shut cases that will generate plea deals. According to a retired police officer interviewed by NPR, Vernon Geberth , police nowadays have a higher bar to get over in trying to clear a case because prosecutors want only those easier cases.

And what is the No. 1 source of this prosecutorial overload? According to federal judicial caseload statistics, in U.S. district courts in 2013, 32 percent of defendant filings were for drug-related cases, making this the biggest category of filings. State judicial systems, too, have been significantly strained for financial resources and personnel by drug-related casework. Add to this picture the fact that plenty of violent offenders in our nation’s prisons started out as nonviolent drug offenders, and you have a complete picture of just how much the drug war itself has been a generator of violence.

The drug war is a perfect example of the breakdown of the rule of law and the knock-on effects of such a breakdown. Our drug laws are fundamentally unenforceable, and this distorts the judicial system, including by producing prosecutorial overload, which is a driver of low homicide clearance rates, which beget a culture of increasing violence, which puts more fathers of young children behind bars or under the ground, makes it harder for children in poor, urban areas to walk to school safely, and forces on those children a choice between the culture of the schools, inside the rule of law, and the culture of the streets, outside the rule of law. Since Plato, we have known that the power of schools to develop the minds of the young depends on an alignment of the worlds inside and outside the school. The culture of violence in urban areas, begotten by the war on drugs and a reflection of the failure of the rule of law, is the opposite of a healthy context for learning.

Why is it so hard for us to see how profoundly a $100 billion illegal market in anything, even in popcorn or “My Little Pony” toys, would distort a society? Can there be any other reason for our failure to see this than that black and brown people bear the brunt of these distortions? If we care for the safety and happiness of the whole of our society, as we must, then it is time to legalize marijuana, decriminalize other drugs and recast drug use as a public health problem, not a crime.