PATIENTS expect drugs to be safe. But even in supposedly well-run health systems, they can be useless—or deadly. Tainted steroids from a compounding pharmacy (one which mixes its own drugs) near Boston had killed 11 people with fungal meningitis and sickened more than 100 as of October 10th. A contaminated blood thinner, heparin, was linked to 149 American deaths in 2007-08. This year it emerged that some vials of the cancer medicine Avastin contained no active ingredient.

No one knows exactly what share of medicines are fake, ill-made, stolen or diverted. But bad pharma is a global problem, which national drug-safety agencies are struggling to contain. It particularly afflicts countries where officials are bribable, health systems lax and consumers desperate. In Nigeria, Africa’s largest market for medicines, a survey by the World Health Organisation (WHO) in 2011 found that 64% of antimalarial drugs were fake. Over 70% of drugs consumed in Nigeria are imported from India and China, widely seen as the biggest source of fakes. Paul Orhii, of Nigeria’s drug agency, blames “a shambolic system and porous borders”.

Salesmen have peddled worthless cures for millennia. But the 21st century is turning into a golden age for bad drugs. In Boston, the fungal meningitis spread because of poor oversight. Price pressure encourages even well-intentioned drugmakers to cut corners. For criminals, fake pharma is lucrative and the penalties are usually low. Indeed, the drug supply-chain is a cheat’s paradise.

Raw materials come from one place and are processed into active ingredients in another. Pill-fillers and coating come from other sources. Manufacturing and packaging may be separate. To reach the dispensary, the drug passes through distribution chains (and may be repackaged). In America 80% of drugs’ active ingredients come from abroad (drug imports there more than doubled from 2002 to 2010, accounting for 40% of finished medicine).

This creates a regulatory nightmare. In the heparin case Chinese suppliers replaced the main ingredient with a cheaper, dangerous substance that still passed authentication tests. The fake Avastin apparently hopped from Turkey to Britain to America, with help from a Canadian online pharmacy. Do-gooding attempts may backfire, too. The WHO has a “prequalification” scheme that authorises cheap, good drugs for aid programmes. But Roger Bate of the American Enterprise Institute, in a paper published in July, found that 7% of such drugs in his sample failed.

Attempts abound to stem the scourge. The latest raids in Operation Pangea (an international police campaign against illegal online pharmacies) involved 100 countries and shut down more than 18,000 online pill-pushers. But such pharmacies are not necessarily the villains: they often sell real drugs (at low prices); and many fakes are on sale from reputable offline outlets.

Some poor countries think that rich ones simply want an excuse to bust their generic drug industries. Rows about the definition of “counterfeit” have crippled the WHO’s International Medical Products Anti-Counterfeiting Taskforce, or IMPACT, launched in 2006. Now new working groups are mulling the meaning of SFFC (“spurious/falsely-labelled/falsified/counterfeit”) drugs. It may add another “S” for “substandard”. Pirates are not trembling.

Most other international efforts are moving slowly, says Mr Bate, author of a book called “Phake”. To punish counterfeiters more harshly and speed information-sharing, 18 European countries signed the Medicrime convention in 2011. But only Ukraine has ratified it. The G8 group of rich countries published a wordy declaration in May, but has done little since.

For years governments and companies have talked about “track-and-trace” systems to identify and authenticate medicines. Though the technology exists, countries cannot agree what to use. Different firms hawk their own schemes; regulators disagree about what should be tracked.

My pills, not yours

So individual states are taking their own steps. Nigeria has spearheaded an impressive counterattack, which by some counts has brought the share of fake medicines down from around half to a tenth in five years. One means is TruScan, a cheap hand-held spectroscope that allows officials to spot fakes at the point of import (America, Germany, Sweden and Canada now use this, too). Nigeria has also deployed a scratch-off label system, in which users text the revealed code from their phones to verify the product before consuming it. But the scheme is voluntary and so far only a few firms are using it.

China, concerned for the reputation of its drug-export trade, has staged big seizures of fakes (detaining nearly 2,000 people in August). It executed its top drug official in 2007 for approving untested medicine in exchange for bribes. India has commissioned feasibility studies of track-and-trace technology from Wipro, a software and services giant. The government talks of better manufacturing standards, but exhortation has yet to lead to action.

America’s Food and Drug Administration (FDA), the world’s biggest drug-safety agency, has steadily reached beyond the country’s borders. Since 2008 it has opened offices in China, India, South Africa, Jordan, Mexico, Belgium and other countries. A recent law sets higher penalties for counterfeiters and allocates money for the agency to inspect more factories overseas. But even the FDA admits it cannot police the world’s drug supply alone.

Drug firms often make better enforcement partners than governments do. John Clark, security chief for Pfizer, a pharma giant that makes Viagra, likes to tell a story about a man caught selling fakes who asked an undercover agent first if he was with “the Feds”, then whether he worked for Pfizer. His firm employs former police, investigators and customs officials all over the world. Usually it builds about 80% of a case, then hands it to local law-enforcers.

Yet, as officials fiddle, the problem grows. In January 2009, 81 countries noted counterfeit versions of 20 Pfizer drugs. As of July 2012, 106 had found 60 such fakes. “Counterfeiting is like a balloon filled with water,” says Nigeria’s Mr Orhii. “You push it on one side but when you remove your hand, it bounces back even stronger.”