In response to a scandal involving fabricated and unconstitutional drug searches by plainclothes San Francisco police officers, Golden Gate University law professor Peter Keane explains "Why Cops Lie":

Police officer perjury in court to justify illegal dope searches is commonplace. One of the dirty little not-so-secret secrets of the criminal justice system is undercover narcotics officers intentionally lying under oath. It is a perversion of the American justice system that strikes directly at the rule of law. Yet it is the routine way of doing business in courtrooms everywhere in America.

Keane, a former San Francisco police commissioner, cites three reasons for this state of affairs: unsympathetic suspects, judges who bend over backward to admit evidence except when the signs of falsification (such as the surveillance footage feeding the current scandal) are impossible to ignore, and the incentives created by the war on drugs:

It is simply additional collateral damage from using the American criminal justice system as the battlefield of that war. It stands alongside the wasteful wreckage of hundreds of thousands of imprisoned Americans locked up for drug use, and the destruction of Mexico as a functioning state because of criminal cartels enriched through outlawed American drug use. The corruption of America's police officers as the most identifiable group of perjurers in the courts is one more item on that list.

More on "testilying" here, here, and here.

[Thanks to Richard Cowan for the link.]