CHARLESTON, W.Va. (AP) — Rite Aid Corp. has agreed to pay $4 million to settle a federal investigation in West Virginia of the drug store chain's sales of pseudoephedrine, a cold medication ingredient used illegally in homemade methamphetamine labs, prosecutors said Wednesday.

U.S. Attorney Mike Stuart said in a news release that Camp Hill, Pennsylvania-based Rite Aid accepts responsibility for the improper sales, which occurred between January 2009 and October 2012 in the state's southern district.

The statement said the company's policies led employees in the district to believe they could only deny a pseudoephedrine sale if it would cause a customer to exceed a purchase limit amount, and not if the customer was suspected of wanting the drug for an illegitimate reason, such as the manufacture of meth.

The statement said Rite Aid has instituted changes in its training, policies and procedures for selling pseudoephedrine, including placing such products out of customer view and requires pharmacists to provide counseling to customers seeking to buy them.

"This settlement sends a strong message to businesses that we will not tolerate putting sales over safety," Stuart said.

Under the settlement, Rite Aid will pay $2.6 million to the West Virginia Crime Victims Compensation Fund and $1.4 million to the state Department of Health and Human Resources for substance abuse treatment.

According to the West Virginia Health Statistics Center, the state saw a record number of fatal overdoses from methamphetamine last year, increasing by 500 percent since 2014. About half of the overdoses involved meth laced with the powerful synthetic opioid fentanyl.

Health Department Cabinet Secretary Bill J. Crouch said the regulation of drugs such as pseudoephedrine is critical to improving West Virginia's substance abuse epidemic.

"This funding will support DHHR's ongoing efforts to strengthen substance abuse treatment programs and ultimately improve the health and well-being of impacted residents across the state," Crouch said.