Google Inc. has agreed to forfeit $500 million to settle claims that it allowed online Canadian pharmacies to place advertisements targeting consumers in the United States, U.S. Justice Department announced Wednesday.

The Canadian pharmacies placed ads through Google's AdWords program which resulted in the illegal importation of prescription drugs, the government said.

The $500 million represents the money Google made from selling the drug ads, plus the revenue earned by Canadian pharmacies from sales to American customers.

A government investigation conducted by the U.S. Attorney's Office in Rhode Island and the FDA/OCI Rhode Island Task Force learned that Google was aware as early as 2003 that it was illegal for Canadian pharmacies to ship controlled and non-controlled prescription drugs to America, said the Justice Department.  

The shipment of prescription drugs from pharmacies outside the United States to customers in the United States violates the Federal Food, Drug and Cosmetic Act and in the case of controlled prescription drugs, the Controlled Substances Act.

The Department of Justice will continue to hold accountable companies who in their bid for profits violate federal law and put at risk the health and safety of American consumers. This settlement ensures that Google will reform its improper advertising practices with regard to these pharmacies while paying one of the largest financial forfeiture penalties in history, Deputy Attorney General James Cole said in a statement.

Google became aware of the investigation in 2009. It began efforts to prevent further illegal exchanges, including hiring an independent company to help detect pharmacy advertisers exploiting flaws in the Google's screening systems, reports Reuters.

The company revealed in May that it was setting aside $500 million for a potential settlement of a government investigation into its advertising business.

Google issued a statement saying that it had given up the practice, while acknowledging that it should not have carried the ads.

While we banned the advertising of prescription drugs in the U.S. by Canadian pharmacies some time ago, it's obvious with hindsight that we shouldn't have allowed these ads on Google in the first place, the company said.