CHARLESTON, W.Va. — West Virginia Attorney General Patrick Morrisey said Tuesday his agency is transferring $1 million to the state police in an effort to end a backlog of drug testing in criminal cases.

Morrisey said the transfer was made possible as the result of settlements with drug wholesalers accused of flooding the state with millions of prescription pain pills.

The State Police Forensic Laboratory examines drug seizures from every police department in West Virginia. The drug testing backlog intensifies regional jail crowding by affecting bail consideration for suspects. It also adds to county inmate costs.

“We have to make sure that we end this terrible backlog,” Morrisey said at a news conference.

State police Superintendent Jan Cahill said he appreciates the funding and “it will go a long way.”

According to FBI statistics, there were 6,187 drug-related arrests in West Virginia in 2015, which was 15 percent of all arrests in West Virginia. The figures, the latest available, did not include traffic-related arrests.

Morrisey’s office also gave the state police $1 million last year to hire additional analysts, offer overtime and purchase necessary equipment.

Since 2013, Morrisey has returned more than $39 million to the state’s general fund.