Steven Bochco, a television writer and producer whose gritty police procedurals and courtroom dramas, notably “Hill Street Blues,” “L.A. Law” and “NYPD Blue,” injected ambitious storytelling, quirky ensemble casts and occasional nudity into what was then a critically derided form of mass entertainment, died April 1 at his home in Los Angeles. He was 74.

The cause was complications from cancer, his assistant Nathan James said.

Mr. Bochco received 10 Emmys and four Peabody Awards for shows he helped create, and he maintained a reputation as someone who, NBC chairman Grant Tinker once said, “rocks the boat as a hobby.”

A former story editor and scriptwriter for the NBC drama “The Name of the Game” and the Peter Falk detective program “Columbo,” Mr. Bochco went on to develop shows that ranged from unblinking realism to badge-and-gun musical fare, seeking to create works of art in what he described as “a commercial sales medium.”

He co-created several shows, including “Doogie Howser, M.D.,” about a teenage doctor inspired partly by Mr. Bochco’s own father, a child prodigy on the violin; the short-lived 1990 series “Cop Rock,” a bizarre blend of police procedural and Broadway musical; “Murder One,” which followed one court case over a single season; and “Hooperman,” a comedy-drama starring John Ritter as a San Francisco police inspector.

Mr. Bochco was best known for his law-and-order dramas, which featured tangled stories of rape, forced confessions, marital affairs and — in “L.A. Law” — a secret sex position known as “the Venus Butterfly.”

Unlike police-show precursors such as “Dragnet” and “Hawaii Five-O,” good and evil were rarely cleanly distinguished, and detectives were given foibles, flaws or idiosyncrasies, including favored euphemisms for masturbation or a habit of biting suspects.

Notable deaths in 2018 and 2019: Nipsey Hussle, George H.W. Bush, Stan Lee, John McCain, Aretha Franklin and other famous faces we’ve lost

Nipsey Hussle, a Grammy nominated rapper who sought to revive South Los Angeles, died at age 33 on March 31. Read the obituary (Matt Winkelmeyer/Getty Images for Warner Music)

“There is no ‘Sopranos’ without ‘Hill Street Blues,’ ” Syracuse University pop culture professor Robert Thompson told CNN in 2014, explaining the influence of Mr. Bochco’s best-known creation. “Matt Weiner (‘Mad Men’) and Vince Gilligan (‘Breaking Bad’) and David Chase (‘The Sopranos’) and all these people ought to wake up every morning and send a note to ‘Hill Street Blues.’ ”

Mr. Bochco said that when NBC invited him and writing partner Michael Kozoll to create a police program, their aim was to make “a show about people who happen to be cops, as opposed to cops who, in some small corner of their lives, happen to be people.” They wrote the first script for “Hill Street Blues” in 10 days.

The show premiered in January 1981 and received 21 Emmy nominations in its first season, winning 26 over its seven-season run. Set in an unnamed city, the series employed handheld camerawork — a documentary technique — and blended dark comedy with moments of unexpected tragedy. Two lead characters were gunned down at the close of the first episode.

The series’ sprawling cast featured friends of Mr. Bochco’s and acquaintances he knew from college, including Charles Haid (Officer Andy Renko), Bruce Weitz (Sgt. Mick Belker) and Mr. Bochco’s then-wife Barbara Bosson (Fay Furillo, ex-wife of Capt. Frank Furillo). “Bochco,” he once joked, “is Polish for nepotism.”

Among the most lasting innovations of “Hill Street Blues” was the use of multiple story lines that spanned episodes and seasons — and which led one viewer to suggest to Mr. Bochco that he had created the first television show with a memory.

Mr. Bochco produced “Hill Street Blues” for MTM Enterprises, the production company co-created by Mary Tyler Moore, but was fired in 1985 amid debates over the show’s high costs. Single episodes reportedly cost as much as $1.4 million, about twice as much as other hour-long police shows. Mr. Bochco later told Rolling Stone he was let go from the company partly because “some people consider me difficult.”

He went on to make “L.A. Law,” which he co-created with screenwriter Terry Louise Fisher, a former deputy district attorney in Los Angeles County. The series premiered on NBC in 1986, retaining Mr. Bochco’s flair for pitch-black comedy with an opening scene that showed a dead lawyer slumped over his desk, with colleagues arguing over who would take his office.

The next year, Mr. Bochco signed a $50 million deal with ABC to produce 10 new series through a newly formed company, Steven Bochco Productions. As part of that deal, Mr. Bochco created “NYPD Blue” with screenwriter and “Hill Street” veteran David Milch.

The show became a top-10 hit for ABC, airing for 12 seasons, but it was boycotted by 57 local ABC stations when it premiered in 1993. It featured as many expletives as the network’s broadcast-standards department would allow — 37 foul words per episode — and frequent instances of partial nudity, leading Mr. Bochco to describe it as the first R-rated series on television.

Negotiating the limits of the show’s boundary-breaking content was sometimes painful, sometimes surreal, Mr. Bochco said. He once sat in ABC executive Bob Iger’s office “drawing pictures of naked girls” like a sixth-grade child, Mr. Bochco recalled in an interview with the Archive of American Television. “Neither one of us, believe me, is Picasso. But it was the only way I knew to say, ‘You’re going to see this, but you won’t see that.’ ”

Steven Ronald Bochco was born in New York on Dec. 16, 1943. He was raised in Manhattan’s Upper West Side, where his mother was a painter and jewelry designer and his father was a violinist.

Aspiring to become a playwright, Mr. Bochco studied theater at what is now Carnegie Mellon University in Pittsburgh and graduated in 1966.

His marriage to Gabrielle Levin, the daughter of a Hollywood lawyer, was short-lived but helped him land a job at Universal Pictures in Los Angeles, according to the Times. He worked as a story editor and eventually co-wrote the screenplay for the popular 1972 science-fiction movie “Silent Running.” However, he decided to focus on television, believing it offered him more creative independence.

In recent years he worked with the cable network TNT, where he created the legal drama “Raising the Bar” and the detective series “Murder in the First.”

His marriages to Levin and Bosson ended in divorce, a legal process that Mr. Bochco addressed in his ABC drama “Civil Wars.” In 2000, he married Dayna Kalins, who produced his medical series “City of Angels.” In addition to his wife, survivors include two children from his second marriage, Jesse Bochco and Melissa Bochco; a stepson, Sean Flanagan; a sister, actress Joanna Frank, who appeared in “L.A. Law”; and two grandchildren.

Mr. Bochco maintained tight control over his productions, frequently doctoring scripts when he wasn’t writing them himself in pencil on a yellow legal pad. He said while failure was an inherent part of television, he felt pressure when working on a new show such as “L.A. Law.”

“It’s not external. It comes from inside. I’m not afraid of failing, but I am afraid of doing bad work,” he told the Times in 1986. “It’s not so much that I want to top myself. It’s how do I maintain the standard?”