Google has agreed to pay $500 million to settle charges that it posted ads for illegal pharmacies in one of the largest forfeitures ever paid in the U.S., the Justice Department announced Wednesday.

The fee reflects the revenue Google generated from the advertising revenue made through Canadian pharmacies, plus the gross revenue the pharmacies made from sales to U.S. consumers.

The company has been under investigation by the department over allegations that it profited from ads for illegal online pharmacies, The Washington Post reported in May. Online ad sales are a major part of Google’s revenue.

Peter Neronha, the U.S. District attorney for Rhode Island, made the announcement and said that Google will not face criminal prosecution.

Under the terms of the settlement, Google acknowledged that it helped Canadian online pharmacy target ads for illegal organizations through its AdWords platform. The company accepts responsibility and will pay $500 million as a settlement. Google must also follow a “number of compliance and reporting measures” to make sure similar conduct does not happen in the future.

“We banned the advertising of prescription drugs in the U.S. by Canadian pharmacies some time ago,” an e-mailed statement from Google said Wednesday. “However, it’s obvious with hindsight that we shouldn’t have allowed these ads on Google in the first place. Given the extensive coverage this settlement has already received, we won’t be commenting further.”

In March, Google settled with the Federal Trade Commission over privacy issues with its buzz networking system, and has acknowledged that it’s under investigation for its search practices by the FTC.

The company has also faced scrutiny in Europe over privacy issues related to its Street View mapping program.

Many had expected a settlement of this size, when Google revealed that it had set aside $500 million for a government settlement.

Related stories:

More technology coverage from The Post

Google settles privacy complaint with FTC over Buzz social networking launch

Google under government investigation for online pharmacy ads

Google’s FTC probe just the latest investigation into company’s practices