LOS ANGELES >> Joseph Wambaugh, who wrote the gripping, true-crime bestseller “The Onion Field” and numerous gritty but darkly humorous novels about day-to-day police work drawn from his own experiences as a Los Angeles police officer, has died at 88.

A family friend, Janene Gant, told The New York Times that Wambaugh died Friday at his home in Rancho Mirage, and the cause was esophageal cancer.

The prolific author, who initially planned to be an English teacher, had been with the Los Angeles Police Department 11 years and reached the rank of sergeant when he published his first novel, “The New Centurions,” in 1971.

It took a hardened, cynical look at the lives of police officers and the stresses they face patrolling the often mean streets of Los Angeles.

He followed it with a similar novel, “The Blue Knight,” in 1972.

“If he didn’t invent the police novel, he certainly reinvented it,” Michael Connelly, author of the bestselling cop novels featuring LAPD Detective Harry Bosch, told The Associated Press in 2007.

As popular as Wambaugh’s first two books were, they were eclipsed by his next one, “The Onion Field,” a real-life account of the abduction and killing of a Los Angeles police officer in 1963. Moments after making a routine traffic stop in Hollywood, Officers Ian Campbell and Karl Hettinger were disarmed by the vehicle’s occupants and driven to an onion field near Bakersfield. Campbell was shot to death and Hettinger escaped.

After the book was published, Wambaugh returned to fiction with the wildly funny, although sometimes tragic look at a group of Los Angeles police officers he called “The Choirboys.”

Like his first two novels, it included fictionalized accounts of first- and second-hand experiences, and explored the back stories of cops, the people they were sworn to protect and even some they arrested.