Congress has historically treated drug abuse as a malady afflicting mostly poor, minority communities, best dealt with by locking people up for long periods of time. The epidemic of drug overdose deaths ravaging white populations in cities and towns across the country has altered this line of thinking and has forced lawmakers to acknowledge that addiction is a problem that knows no racial barriers and that can best be addressed with treatment.

This realization is driving bipartisan support in Washington for saner, less-punitive drug policies, some of which Congress steadfastly resisted for decades.

Recently, Congress effectively lifted a destructive, long-standing ban that prevented state and local governments from using federal money on needle-exchange programs. A similar shift in attitude is reflected in bills like the Comprehensive Addiction and Recovery Act, which is pending in both houses of Congress. Its purpose is to expand and improve drug-treatment services nationwide.

The need for such services was underscored in a recent New York Times analysis based on data released by the Centers for Disease Control and Prevention. It shows that drug-overdose deaths driven primarily by addiction to prescription painkillers and heroin had increased in nearly every county between 2002 and 2014, a year when more than 47,000 people — an average of about 125 a day — died of overdoses. Some medical experts likened the toll to the HIV epidemic in the 1990s, but with this difference: Then, HIV deaths were mainly in urban centers; now, rural areas have higher drug-overdose death rates than large cities.

Drug addiction has been especially visible in New Hampshire, where voters have been raising the issue with visiting presidential candidates. The deadly drug of choice in New Hampshire is a brand of heroin mixed with a highly potent painkiller called fentanyl. In Appalachia, deaths frequently occur among injured workers who become addicted to widely prescribed painkillers.

In addition to driving up mortality rates, excessive use of painkillers costs the country tens of billions of dollars in lost productivity, medical complications and higher insurance costs.

The Recovery Act would attack these problems on several fronts. First, it would direct the secretary of health and human services to convene an interagency task force to develop a system of best practices for prescribing pain medications that would then be conveyed to doctors. It would authorize the attorney general to make grants to state and local governments, nonprofit agencies and other entities to assist them on several fronts: expanding or developing alternatives to incarceration, such as treatment, for certain defendants; improving educational opportunities for offenders in jails, prisons and juvenile-detention facilities; making more widely available the drug naloxone, which reverses the effects of an overdose; creating high-quality drug-treatment programs, and establishing places where people with unused medications can safely dispose of them.

An important provision would help states strengthen prescription-drug monitoring systems. Insurers would be able to track pharmacies that illegally dispense drugs, as well as consumers who get unnecessary prescriptions from multiple doctors — either to satisfy their own habits or to sell them to other parties. The prescription data also would allow addiction-treatment programs to make sure that patients take only the drugs required for their treatment regimens.

The act represents a rational approach to drug policy. It would be a first step in a long and difficult struggle to get the national addiction crisis under control, and it deserves approval as soon as possible.