Google will pay $500 million to settle federal government charges that it has knowingly shown illegal ads for fraudulent Canadian pharmacies in the United States, the Justice Department announced on Wednesday.

The federal investigation, which was first revealed in May, found that Google was aware that some Canadian pharmacies that advertised on its site failed to require a prescription for substances like the painkiller Oxycontin and the stimulant Ritalin. Google continued to accept their money and assisted the pharmacies in placing ads and improving their Web sites, according to the Justice Department.

Illegal online pharmacies have been a challenge for regulators, because the Internet makes it easy for them to operate under the radar and emerge under different names when they get shut down.

Search engines like Google drive much of the traffic to these sites, say researchers who study online pharmacies. Web sites are liable for advertising that breaks federal criminal law.

Since 2009, when it became aware of the investigation, Google has taken significant steps to chase illegal pharmacies from its site.



“Google does have a responsibility in this regard,” said Susan E. Foster, director of policy research and analysis at Columbia University’s National Center on Addiction and Substance Abuse. “To the extent that they continue to allow ads for illegal pharmacies, they’re aiding and abetting the problem and profiting from it as well.”

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

In a statement issued by the Justice Department, James M. Cole, a deputy attorney general, said, “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.”

The $500 million fine covers both revenue that Google earned from the illegal advertisers and revenue that the rogue Canadian pharmacies received from American customers buying controlled drugs. Google had said in May that the fine decreased its quarterly profit by 22 percent.

Under the settlement, Google also acknowledged that it had improperly aided the rogue pharmacies, and it agreed to strict compliance measures.

The online ad business for health care and pharmaceutical companies is expected to be $1.6 billion this year, up 24 percent from $1.3 billion last year, according to eMarketer, a digital marketing research firm.

Google has been fighting rogue online pharmacies since 2003, and Sheryl Sandberg, former vice president for global online sales at Google and currently the chief operating officer at Facebook, testified before the Senate in 2004 that Google had the problem under control.

According to a former Google executive, who would speak only anonymously because the person was not authorized to discuss the business, said Google did not turn a blind eye to the pharmaceutical advertising, but rather played a game of Whac-A-Mole with the rogue pharmacies.

Over the last two years, Google has made changes to crack down on rogue pharmacy advertisers.

After Google became aware of the investigation, it has required that all Canadian pharmacy advertisers be certified by the Canadian International Pharmacy Association and has specified that they can advertise to Canadian customers only. American pharmacy advertisers must be certified by the National Association of Boards of Pharmacy.

Google had previously relied on the private firms Square Trade and PharmacyChecker.com to certify pharmacy advertisers, but according to PharmacyChecker.com and the Justice Department, advertisers that never applied nonetheless appeared on Google.

Google has also always monitored ads shown for drug-related keywords, like “painkiller” or “Ritalin.” But Michael Zwibelman, litigation counsel for Google, has described its policing efforts as “an ongoing, escalating cat-and-mouse game.”

“As we and others build new safeguards and guidelines, rogue online pharmacies always try new tactics to get around those protections and illegally sell drugs on the Web,” Mr. Zwibelman wrote in a company blog post last year.

The investigation, which was led by officials from the United States attorney’s office for the District of Rhode Island, headed by Peter Neronha, and the Food and Drug Administration’s Office of Criminal Investigations, began during an unrelated financial fraud investigation, the Justice Department said.

The target of that inquiry fled to Mexico and began illegally advertising drugs through Google’s AdWords program. After he was apprehended, he began cooperating with the government, which created undercover Web sites to advertise the illegal sale of drugs on Google.

Eric Goldman, director of the High Tech Law Institute at Santa Clara University, said the settlement showed that the United States government was taking an increasingly active role in regulating the Web. “They’re going out of their way to cut off these bad actors internationally and enlisting U.S. enterprises to help them in that fight,” he said.