Google Inc has agreed to pay $500 million to settle a criminal probe into ads it accepted for online Canadian pharmacies selling drugs in the United States, the U.S. Justice Department said on Wednesday.

The advertisements led to illegal imports of prescription drugs into the country, the Justice Department said.

The $500 million represents Google's revenue from Canadian pharmacy advertisements to U.S. customers through Google's AdWords program and Canadian pharmacies' revenue from U.S. sales. The forfeiture is one of the largest ever in the United States, according to the department.

Google had previously set aside that amount for a possible settlement over its advertising practices, according to a regulatory filing in May.

Google, the world's No. 1 Internet search engine, had $29 billion in gross revenue in 2010.

One Justice Department concern was that some Canadian online drugstores failed to require a prescription but accepted an online consultation to dispense pharmaceuticals, the department said.

Google was also on notice that many pharmacies accepting an online consultation rather than a prescription charged a premium for doing so because individuals seeking to obtain prescription drugs without a valid prescription were willing to pay higher prices for the drugs, the department said.

Another question was ensuring the drugs' safety, the department said.

While Canada has its own regulatory rules for prescription drugs, Canadian pharmacies that ship prescription drugs to U.S. residents are not subject to Canadian regulatory authority, and many sell drugs obtained from countries other than Canada which lack adequate pharmacy regulations, the Justice Department said.

Google at one time accepted advertising from overseas online pharmacies but later confined such ads to those from the United States and Canada.

Google announced in a February 2010 blog post that it would no longer allow Canadian pharmacies to advertise to U.S. customers.

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

The drug and biotech trade group Pharmaceutical Research and Manufacturers of America was pleased with the settlement. Vice President Karl Uhlendorf said it confirms the high risks associated with purchasing medicines over the Internet.

In addition to the financial settlement, the agreement sets compliance and reporting measures which Google must take.

(Additional reporting by Jeremy Pelofsky and Alexei Oreskovic; Editing by Tim Dobbyn, Matthew Lewis and Steve Orlofsky)