Peter Lovesey, a prolific British crime fiction author whose first whodunit was written as a contest entry and launched a career that took readers into Victorian salons and sooty back alleys as he mixed history and murder, died April 10 at his home in Shrewsbury, England. He was 88.

The cause was pancreatic cancer, said a statement from Soho Press, his American publisher.

With a penchant for sardonic observations and quirky subplots, Mr. Lovesey’s more than 40 novels collectively sold millions of copies and brought adaptations including a British television series, “Cribb,” based on his working-class 19th-century detective, Sgt. Daniel Cribb.

Along with writers such as P.D. James and Ian Rankin, Mr. Lovesey was credited with helping reinvigorate British detective fiction with stories that injected more social commentary and moral complexities into the classic puzzle-solving traditions of Agatha Christie and others.

“In the beginning, I was interested in the setting and all that Victorian detail which I found amusing,” Mr. Lovesey said in a 1993 address in Cincinnati. “Now I’m interested in the clash of personalities — the connections with people.”

Mr. Lovesey crafted three popular series, each with distinctive sleuths. He began with the street-smart Victorian detective Cribb in 1970 with “Wobble to Death,” Mr. Lovesey’s winning entry in the writing contest. (The character was portrayed by Alan Dobie in the 1980-1981 Granada Television series “Cribb” that was rebroadcast by PBS in the United States.)

Mr. Lovesey then reimagined Queen Victoria’s eldest son, Prince Albert, or “Bertie,” the future Edward VII, as an amateur, and sometimes bungling, clue hunter in novels including “Bertie and the Tinman” (1988), a story that begins with the death of a renowned British jockey.

Mr. Lovesey eventually moved into modern-day Britain with a gruff cop named Peter Diamond, whose inclination is to rough up a suspect rather than go by the book. In “Diamond and the Eye” (2021), Diamond is forced to work with an insufferable American gumshoe in an investigation of a murder in an antique shop.

The killer used a bust of Julius Caesar — a historically significant clue in the English city of Bath, founded as a thermal spa during the Roman Empire.

Nearly all Mr. Lovesey’s mysteries and mayhem remained rooted in England and its eccentricities. His start in crime fiction had its own very English origins. In 1969, he was “perusing the personals columns of the [London] Times as Sherlock Holmes used to do,” he recalled, and came across an advertisement for the crime novel contest by publishers Macmillan and Panther Books.

The prize was 1,000 pounds — more than his annual salary as a teacher. “I was drawn to mystery writing by the lure of money,” Mr. Lovesey once said.

He had one nonfiction book under his name, “The Kings of Distance” (1968), biographies of five world-class distance runners. Mr. Lovesey knew track and field history but was stumped on how to create a crime thriller, he recounted.

His wife, Jacqueline, encouraged him to comb his book research for a plot idea. He found one from the Victorian age: a six-day endurance competition of walking and running (and drug use to keep going) known colloquially as the “wobbles.”

His manuscript, titled “Wobble to Death,” introduced Sgt. Cribb as he probed the death of a participant in a fictional 1879 event. After he took the writing prize, the publisher asked him what was next.

He stayed with Victorian life. His next book, “The Detective Wore Silk Drawers” (1971), was set in the underground world of bare-knuckle prize fighting in London. Cribbs and his Watson-like assistant, Constable Edward Thackeray, go to investigate a music hall murder in “Abracadaver” (1972); infiltrate pro-independence Irish bombers in “Invitation to a Dynamite Party” (1974); and dig into a possible wrongful murder confession in “Waxwork” (1978).

Mr. Lovesey said he took special pleasure in creating scenes that exposed the hypocrisies and social facades of the Victorian upper crust. Cribb shows them no deference. In the Bertie novels, the future monarch can be oblivious to the privileges that surround him.

At one part in “Bertie and the Seven Bodies” (1990) — about a series of killings at a county estate — Prince Albert discusses at length how it takes more than 200 staff for a good pheasant hunt. Other books in the Bertie series include “Bertie and the Crime of Passion” (1993) as he teams up with stage actress Sarah Bernhardt to investigate a murder at a Paris nightclub in 1889. (In real life, Prince Albert became king after Victoria’s death in 1901 and ruled until 1910.)

“The rueful, candid voice [Lovesey] gives to the fleshy prince rings true,” reviewer William A. Henry III wrote in Time magazine.

The success of the Cribb and Bertie novels also opened the way for other British writers to create “period” sleuths such Marcus Didius Falco in Ancient Rome (by author Lindsey Davis) and Matthew Shardlake in 16th-century England in the books of C.J. Sansom.

“The Victorian era was a comfort zone for me,” Mr. Lovesey told Crimespree magazine in 2007. “So it was a long time — twenty-one years — before I dared write anything contemporary.”

That became the cop Diamond, who had little patience for modern forensics or police protocols and thought a quicker way to the truth was a bit of muscle. Diamond debuted in “The Last Detective” (1991) as he investigated the murder of a former soap opera star in Bath. A side plot includes missing letters from the novelist Jane Austen.

Over the next 21 books in the Diamond series, the detective mellows somewhat but keeps his disdain for technology (much like Mr. Lovesey who stuck with pen and paper for decades) and pretense. In “Down Among the Dead Men” (2015), as he listens to a supervisor expound on the escargot, fresh turbot and spring vegetables she had for dinner, Diamond recalls the double burger he ate the night before.

Besides his detective series, Mr. Lovesey wrote other crime fiction with historical overlays including “The False Inspector Dew” (1981), a tale of a man planning to murder his wife on board the luxury liner SS Mauretania in the 1920s. His novel “Goldengirl” (1977), written under the nom de plume Peter Lear about obsession and intrigue at the Olympics, was made into a 1979 movie starring Susan Anton and James Coburn.

His awards include the Crime Writers’ Association Diamond Dagger in 2000 for lifetime contributions to the genre.

Peter Harmer Lovesey was born in Whitton, a western London suburb, on Sept. 10, 1936. His father was a bank clerk, and his mother cared for the home.

In 1944, a bomb during a German air raid destroyed their house. Mr. Lovesey was at school, and his two brothers were alone. They survived by climbing in a fortified cage known as a Morrison table shelter. In the adjacent home, there were no survivors. The Lovesey family was evacuated temporarily to a farm in southwest England.

The war was later used as a backdrop for his crime novels, including “On the Edge” (1989), about two former members of the Women’s Auxiliary Air Force who hatch plots to kill each other’s husband. New York Times reviewer Marilyn Stasio lauded the book’s “impressible joie de mort” and Mr. Lovesey’s ability to “seduce us into cheering them on, right down to the nightmarish ending.”

Mr. Lovesey graduated with an English degree from the University of Reading in 1958 and married Jacqueline Lewis the next year. In addition to his wife, survivors include two children and five grandchildren.

After Royal Air Force service, Mr. Lively taught at Thurrock Technical College (now South Essex College) and Hammersmith College for Further Education (now West London College).

When Mr. Lovesey picked up the 1,000-pound check for winning the crime fiction contest, he hosted a family feast at a London hotel. He thought it would be his only literary payday.

“We ate, drank and were merry,” he recalled, “thinking publication was a one-off, unlikely to be repeated.”