John Singleton, a screenwriter and film director whose powerful 1991 debut, “Boyz N the Hood,” earned him two Oscar nominations and was considered groundbreaking for its humane depiction of the lives of young black men on the violent streets of South Central Los Angeles, died April 29 at a Los Angeles hospital. He was 51.

His family confirmed the death in a statement. The filmmaker, who had hypertension, was hospitalized after suffering a stroke on April 17.

Mr. Singleton was the first African American and the youngest-ever Academy Award nominee for best director. He wrote the “Boyz N the Hood” screenplay, which was also an Oscar contender, as a student at the University of Southern California. In college, he had won scriptwriting prizes, which led to a three-movie deal with Columbia Pictures and $6.5 million to make “Boyz N the Hood.”

He was 22, had never made a movie before and insisted on directing the film. He proved persuasive in negotiations with studio executives.

“I’m a writer first, and I direct in order to protect my vision,” he told the New York Times. “It’s my story, I lived it. What sense would it have made to have some white boy impose his interpretation on my experience?”

Mr. Singleton grew up in a rough part of Los Angeles and said his love of movies — his mother’s apartment was next to a drive-in theater — saved him from a life of delinquency. “Boyz N the Hood” reflected many disparate influences, including François Truffaut’s “The 400 Blows” (1959) and Rob Reiner’s “Stand by Me” (1986), both of which featured children forced by tragic circumstance to confront the starker world of adult realities.

He assembled a cast that included Cuba Gooding Jr., Angela Bassett, Tyra Ferrell, Morris Chestnut and Laurence Fishburne. He also recruited Ice Cube, then known primarily as a hip-hop performer and who was skeptical of the eager young director who pursued him for a leading role as a neighborhood enforcer who seeks to avenge a gang-related killing.

Notable deaths in 2019: Elijah Cummings, Cokie Roberts, Toni Morrison and others we have lost this year

Don Imus | Don Imus, who spent more than half a century in radio and television skating along the edge of propriety and occasionally falling into the abyss of the unacceptable, died Dec. 27 at a hospital in College Station, Tex. He was 79. In a roller-coaster career in which he grew chummy with prominent politicians, repeatedly got suspended or fired for offensive cracks, abused drugs and touted health foods, Mr. Imus won a loyal following, made millions and transformed himself from a bad-boy DJ into a host whose program became a nearly mandatory stop for presidential candidates. Read the obituary (Richard Drew/AP)

“You know, I just felt this dude was a little delusional,” Ice Cube told Vanity Fair in 2016, reflecting on Mr. Singleton’s single-minded determination. “It’s just a pipe dream — that’s what I was thinking.”

But Mr. Singleton exuded such confidence that the singer read the script and showed up for a second audition, which made Columbia executives more enthusiastic about the film’s potential.

Mr. Singleton filmed on location in neighborhoods beset by violence, in which drugs and police brutality were rife, yet he described the movie as “my ‘American Graffiti,’ my coming-of-age story.” He enlisted local gang members to add an extra edge of realism to the clothes and dialogue.

“Boyz” focused on three black teenagers on the cusp of adulthood: a football star named Ricky Baker (Chestnut); his half brother, Doughboy (Ice Cube); and Tre Styles (Gooding), Mr. Singleton’s alter ego and the only young man in the film with a father present in his life.

The film sought to portray the complicated bonds of male friendship — and the sorrow of the boys’ mothers — in a society in which, as a graphic at the beginning of the film pointed out, 1 in every 21 young African American men would die by gunfire.

Critic Roger Ebert pronounced the movie not just a “brilliant directorial debut, but an American film of enormous importance.” The characters, he wrote, “live in a neighborhood where violence is a fact of life, where the searchlights from police helicopters are like the guard lights in a prison camp, where guns are everywhere, where a kid can go down to the corner store and not come home alive.”

When “Boyz N the Hood” was released, it was considered a breakthrough in its depiction of a world previously overlooked by Hollywood filmmakers, even though the moviemaking capital was only miles away. Mr. Singleton joined a group of other African American directors — among them Spike Lee, Robert Townsend and Mario Van Peebles — who were making films about racial justice and the ordinary lives of black people.

But Mr. Singleton’s huge mainstream success — “Boyz” reportedly grossed $100 million — vaulted him to the top of the pecking order. He was 24 when he was nominated for his Academy Awards, two years younger than Orson Welles was when he received a best-director nomination in 1942 for “Citizen Kane.”

Mr. Singleton lost the directing Oscar to Jonathan Demme for “Silence of the Lambs” and the screenplay Oscar to Callie Khouri for “Thelma and Louise,” but his prospects seemed limitless.

“I got out of film school in spring 1990, so they were looking for the next Spike Lee, the next black filmmaker with the vision to make a mark in commercial Hollywood,” Mr. Singleton told the Guardian newspaper in 2018. “So I was the guy. They gave me a chance, gave me $6 million to make a movie, and I knocked it out of the park!”

To far more mixed critical results, Mr. Singleton went on to direct films including “Poetic Justice” (1993), with Tupac Shakur and Janet Jackson, and “Rosewood” (1997), about the massacre of residents of a predominantly black town in 1920s Florida.

Mr. Singleton was criticized for turning to blatantly commercial filmmaking, such as a 2000 remake of the “blaxploitation” action hit “Shaft,” starring Samuel L. Jackson; “Baby Boy” (2001) with Tyrese Gibson and Taraji P. Henson; “2 Fast 2 Furious” (2003), a sequel to the car-chase cop thriller “The Fast and the Furious”; and “Four Brothers,” starring Mark Wahlberg, about four adopted brothers — both black and white — who avenge the death of their mother.

“While you can’t blame a director for giving up on the sort of serious movies that didn’t make any money,” film critic Stephen Whitty wrote in the Newark Star-Ledger, “there’s a feeling that a smart director has dumbed himself down. Yes, he works. But there’s no longer any real message to that work.”

In 2005, Mr. Singleton bankrolled and produced the box-office hit “Hustle & Flow,” the story of a Memphis pimp and aspiring rap star written and directed by Craig Brewer, and in 2017 he was executive producer of A&E’s documentary “L.A. Burning: The Riots 25 Years Later,” which examined racial violence in Los Angeles. The same year, Mr. Singleton created the FX television series “Snowfall,” set amid the 1980s crack cocaine era in Los Angeles, which is still airing.

“I want to become much more than a filmmaker,” he told Ebony magazine in 1995. “My ultimate goal is to run my own studio.”

John Daniel Singleton was born Jan. 6, 1968, in Los Angeles. His father managed a pharmacy and later became a mortgage broker; his mother worked in pharmaceutical sales. He lived alternately with both parents, who were not married.

Drawn to movies at an early age, Mr. Singleton recalled accompanying his mother to see “Cooley High,” a 1975 film about high school friends with a tragic ending.

“I looked at my mother and I said, ‘Why are you crying?’ ” he told Vanity Fair. “And she said, ‘Because it’s such a good movie.’ So I start thinking, when I get to make a movie, I got to make people cry. I got to make them feel something.”

He was 9 when he saw “Star Wars” for the first time, and from then on he was determined to become a filmmaker. In addition to “Stand by Me” and Truffaut’s “The 400 Blows,” another touchstone for Mr. Singleton was ­writer-director John Hughes’s “The Breakfast Club,” a 1985 film set in a high school.

“I didn’t feel alienated by the fact that they were all white kids,” Mr. Singleton told writer David Kamp in 2018 for the Criterion Collection, a video distribution outlet. “They were just teens finding their way into adulthood — like I was.”

He had a short-lived marriage to actress Akosua Busia, the daughter of a prime minister of Ghana. Survivors include a daughter from his marriage and six children from other relationships; his parents, Danny Singleton and Shelia Ward, who acted as her son’s business manager; a brother; and a grandfather.

Mr. Singleton never recaptured the early acclaim of “Boyz N the Hood” — which the Library of Congress’s National Film Registry placed on its list of culturally, historically or aesthetically significant films — but he said his filmmaking dreams had been fulfilled.

“I wanted to be taken seriously as a filmmaker, and my first film was taken so seriously,” he told the New York Times in 2005, “so I kept feeling like each film had to be more serious than the last one. Finally I said, you know what, I’m in this business because movies saved me from delinquency, movies saved my life. I just want to make movies. It doesn’t matter if they’re serious or not.”