The Department of Justice announced a $40 million agreement on Friday with UPS (UPS) to settle allegations that the shipping giant did business with illegal Internet pharmacies.

As part of the deal, the U.S. has agreed not to prosecute UPS in exchange for the company forfeiting $40 million in payments received from doing business with illicit online pharmacies and implementing a strong compliance program.

The DOJ said UPS “has cooperated fully” with the probe and has already taken steps to halt the use of its services by illegal online drug companies.

“We are pleased with the steps UPS has taken to stop the use of its shipping services by illegal on-line pharmacies,” U.S. Attorney Melinda Haag said in a statement. “Good corporate citizens like UPS play an important role in halting the flow of illegal drugs that degrade our nation’s communities.”

However, the DOJ said UPS did not implement procedures to close the shipping accounts of Internet pharmacies despite being put on notice from 2003 through 2010 by employees that some online pharmacies were using its services to ship controlled substances and prescription drugs without valid prescriptions.

“UPS will abide by all laws and regulations that govern our business," said UPS spokeswoman Susan Rosenberg. "We reached the resolution with the Department of Justice and believe UPS has an obligation as an industry leader to accept responsibility and play a role to address the issue of illegal online pharmacies.”

John Roth, director of the FDA’s office of criminal investigations, said the FDA is "hopeful that the positive actions taken by UPS in this case will send a message to other shipping firms to put public health and safety above profits." 

Rival shipping company FedEx (FDX) said in a statement that it is "unclear what federal laws UPS may have violated" but noted that it is "confident that we are in compliance with federal law."

Memphis-based FedEx also said it "stands ready and willing to support and assist law enforcement" and urges the Drug Enforcement Administration to provide a list of pharmacies believed to be operating immediately so that it can "immediately shut off shipping services to those pharmacies." 

Follow Matt Egan on Twitter @MattMEgan5