Google Inc. has agreed to a $500 million payout to the US government, following a Department of Justice (DOJ) investigation which found that Canadian pharmacies were illegally selling prescription drugs to American consumers via ads distributed by the search giant’s advertising arm, Google AdWords.

The settlement, which represents one of the largest forfeitures of its kind in U.S. history, resolves any forthcoming action by the DOJ to bring criminal charges against Google for allegations that the company improperly profited from the Canadian pharma ads which led to the illegal import of prescription pills into the U.S., according to Peter Neronha, U.S. Attorney for the District of Rhode Island.

“This investigation is about the patently unsafe, unlawful, importation of prescription drugs by Canadian on-line pharmacies, with Google’s knowledge and assistance, into the United States, directly to U.S. consumers,” said Neronha in a DOJ statement. “It is about holding Google responsible for its conduct by imposing a $500 million forfeiture, the kind of forfeiture that will not only get Google’s attention, but the attention of all those who contribute to America’s pill problem.”

According to DOJ prosecutors, the shipment of prescription drugs from abroad into the U.S .violates a number of federal laws, and prescription drugs shipped to America from Canada are not subject to supervision by Canadian regulatory authorities. Although Google issued a statement acknowledging its wrongdoing in allowing Canadian pharmacies to advertise drugs to American consumers, prosecutors say that feds have been familiar with the company’s allowance of the AdWords program facilitating unlawful drug sales from Canada since 2003. Also curious is the fact that Canada was the only country allowed to market to U.S. consumers via online pharma ads.

“We banned the advertising of prescription drugs in the US by Canadian pharmacies some time ago,” Google’s statement said. “However, it’s obvious with hindsight that we shouldn’t have allowed these ads on Google in the first place.”