Google has agreed to pay the Department of Justice (DOJ) $500m for its role in allowing online Canadian pharmacies to place advertisements through its AdWords program without verification.

Google is believed to have violated its own advertising policies and allowing illegal drugs to enter the US.

The AdWords program is a big source of revenue for Google, earning the company around $28bn in 2010.

The DOJ said $500m comprises both what Gogle made from the illegal advertising and the revenue the Canadian companies made from their sales to US consumers.

The settlement is one of the largest sums paid by a company to the DOJ.

In May this year, Google revealed that it had adjusted its revenue by keeping $500m for the DOJ probe.

Google had said in a filing with the the Securities and Exchange Commission (SEC), "In May 2011, in connection with a potential resolution of an investigation by the United States Department of Justice into the use of Google advertising by certain advertisers, we accrued $500 million for the three month period ended March 31, 2011."

The investigation, which involved the Food and Drug Administration (FDA), the DOJ and the United States attorney for Rhode Island, is about whether Google displayed ads from online pharmacies that sell fake drugs or drugs that need a prescription from a licensed medical practitioner without verification.

Google had it mandatory for online companies to get their ads vetted by verification firms. However, it has come to light that the practice was stopped in early 2010.

In February this year, Google announced that it would no longer allow Canadian pharmacies to advertise to US 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 had said.