The YouTube video starts with a popular British children’s cartoon character, Peppa Pig, introducing herself and her family, but there are signs of trouble almost immediately. During the ninth second, Peppa’s mother opens her mouth and shouts, “Smoke weed!”

The video -- a doctored version of a real Peppa episode -- deteriorates from there. Over five minutes, there are explosions and racial and homophobic slurs, culminating with Peppa and her parents in dark sunglasses smoking marijuana as rapper Snoop Dogg dances nearby. Since it was uploaded in 2015, the altered video, which has no age restrictions, has been viewed more than 1.5 million times.

After years of vowing to police inappropriate content, YouTube continues to deliver violent imagery, drug references, sexually suggestive sequences and foul, racially charged language in clips that reach children at a troubling pace, say researchers, parents and consumer groups.

YouTube’s recommendation algorithm, they say, fails to reliably segment content by appropriate age levels, and its default autoplay feature delivers almost-endless streams of videos that confuse, upset and titillate young minds. Though many parents try to monitor what their children watch, the sheer volume of YouTube content that many consume makes that impractical, especially when a single, short clip can deliver an array of off-key messages.

“YouTube is the biggest pain point for parents today,” said James Steyer, chief executive of Common Sense Media, a San Francisco-based nonprofit group that advocates for families and schools worldwide. “Kids just stumble into completely inappropriate content constantly because it’s algorithmically driven.”

Steyer and others say YouTube exemplifies a tectonic shift in children’s programming over the past generation — away from the federally regulated, time-constrained world of broadcast television. The increasingly dominant online world delivers all-but-unregulated content that can be uploaded by virtually anyone, almost anywhere in the world, and that can reach children at any time, depending on parental vigilance.

YouTube has consistently said that its platform is not intended for children, and it created the YouTube Kids app in 2015 to satisfy the demand for more heavily curated content aimed at younger audiences.

“Protecting kids and families is a top priority for us,” YouTube said in a statement in response to questions about inappropriate content reaching children. “Because YouTube is not for children we’ve invested significantly in the creation of the YouTube Kids app, a destination made specifically for kids. We don’t allow users under 13 to create or own accounts on YouTube, and when we identify an account of someone who is underage we terminate that account -- we terminate thousands of accounts every week as part of that process.”

But parents, consumer groups and pediatricians report that YouTube itself is wildly popular with children, more so than the kids app. Children watch YouTube on mobile devices — their own and their parents’ — as well as on Internet-enabled televisions and via browsers on laptop computers. Through browsers, YouTube has no requirement that users sign in except in cases when a video carries an age restriction, meaning there’s no practical barrier to children watching most videos on the service.

Videos with age restrictions require users to sign in to an account before watching in order to establish that they are at least 18. This can deter children, though experts say many children lie about their ages to create accounts on YouTube and other services. YouTube said its “review team” puts age restrictions on content that contains vulgar language, nudity, violence or dangerous activities, when such videos are brought to YouTube’s attention. Content with age restrictions cannot carry ads or be monetized by its creators.

In a Pew Research Center poll last year of parents with children younger than 12, more than 80 percent said their children watch YouTube, and 34 percent said their children watch it regularly. In its 2017 annual survey, the market research firm Smarty Pants named YouTube “the #1 kid brand,” calling it “the most powerful brand in kids’ lives." The survey distinguished it from the YouTube Kids app, which was less popular among those between ages 6 to 12.

Researchers say YouTube’s algorithms for recommending content cause particular problems for children because they often sit in front of a screen for long stretches, watching whatever plays automatically. The content, however inappropriate in the view of parents, can mesmerize children lacking the maturity to turn away from words or images that may be unhealthy.

Problems can be especially severe when children search for such popular and seemingly innocuous terms as “Spiderman,” “superhero” and “Elsa.” The icy blonde cartoon princess who starred in Frozen in 2013 has spawned so much doctored, inappropriate YouTube content that critics lump such videos under the shorthand “Elsagate.” Disney did not reply to requests for comment.

Critics also say the problem is not visibly improving. Typing “Peppa” into YouTube’s search engine, for example, generated at least one recommended video that the researchers classified as “disturbing” 70 percent of the time, according to research published in January based on reviews of 2,500 YouTube videos.

Researchers querying such keywords found clips showing a scantily clad Elsa straddling another partially undressed cartoon character, Spider-Man wriggling beneath the sheets with a life-size Rapunzel doll, and Peppa encountering a monster with knives for hands who, amid profanity-laced dialogue, slices open the heads of various characters in bloody attacks. (YouTube said that none of those videos violated its policies and that none appeared on the YouTube Kids app; the one featuring a violent monster carried age restrictions.)

The researchers also found that children have a 45 percent chance of seeing at least one “disturbing” or otherwise inappropriate video within 10 clips — a stretch that often amounts to an hour or so of viewing. Some inappropriate videos were crude animations, some featured actors wearing costumes. Still others, including the marijuana-themed Peppa video, were actual children’s videos that had been doctored with new words and images spliced into the original.

Peppa Pig, a British animated television series for preschoolers that debuted in 2004 and has a global audience, is a particularly popular target for those who make fake alternative versions of original episodes or entirely new videos based on characters from the show. Entertainment One, which produces Peppa, declined to comment.

Graduate students at Cyprus University of Technology who reviewed the videos featuring several characters popular with young children found that the fake videos often contained violence, profanity and sexually charged behavior.

“I’m a parent. It’s definitely happening more often than I’m comfortable with,” said Jeremy Blackburn, a computer science professor at the University of Alabama at Birmingham who co-authored the study and has three children. “The problem is that they can be served and recommended stuff that is not just garbage but inappropriate, just bad stuff.”

A cleanup promise that’s failed

Biologist Leonore Reiser, who lives in Oakland, Calif., said her son, 9, recently reported seeing videos on YouTube that concerned her. When she checked his viewing history, Reiser found one labeled “Two girls want to [expletive] one man.”

It depicted two young women in bathing suits competing for the attention of a man at a public pool and, elsewhere in the video, the same man fondling one of the women’s breasts. Reiser later determined that her son, during a period when he was viewing YouTube unattended, had searched for a profanity, causing the video to surface as a recommended option.

When The Washington Post reviewed the clip, the next set of videos that YouTube’s algorithm recommended — on a panel running down the right side of the screen, under the heading “Up next” — included numerous scenes of sexual intimacy that stopped short of nudity. Most were not restricted by age.

While unhappy about the content her son found while searching with a profanity, Reiser was more upset about the lyrics in some of the rap music that accompanies the football and basketball highlight videos that her son frequently watches. “I’m actually less concerned about the curse words than guys talking about b-----s and hoes and violence,” Reiser said. “That’s what really gets my goat — the violence against women.”

YouTube long has vowed to clean up inappropriate content on its platform amid a succession of controversies involving violent extremism, hateful online conspiracies and troubling children’s content. The company has hired thousands of human moderators and sought to refine its artificial-intelligence systems to better identify and remove videos that violate its community guidelines.

But the efforts have failed when it comes to many types of objectionable content, say researchers, parents and advocates. In just the past few weeks, a video blogger has documented how pedophiles scour videos of children and share time stamps of sexually suggestive moments, in what the blogger compared to a “soft-core pedophilia ring,” and a Florida pediatrician found that a clip explaining how to commit suicide had been spliced into children’s videos on YouTube and YouTube Kids.

Such controversies have prompted some advertisers to abandon YouTube, as Disney, Nestlé and others recently did. But the persistence of the problems have made some of those who study the platform conclude that YouTube’s almost incomprehensible scale — with 500 hours of new video uploaded every minute — has made it so difficult to police that parents should keep their kids from watching it.

One prominent critic, artist and author, James Bridle, who used a Medium post in November 2017 to highlight troubling content YouTube was delivering to children, said that the fixes attempted by the company have not worked. The algorithm continues to identify and deliver the most extreme and stimulating content.

“It seems pretty obvious that that’s just a game of whack-a-mole,” said Bridle, author of “New Dark Age: Technology and the End of the Future.” “The more extreme [a video] is, the more clicks it gets. … Now imagine that applied to small children.”

He was even blunter in a TED Talk last year: “If you have small children, keep them the hell away from YouTube.”

A seemingly bottomless well of video

YouTube’s recommendation algorithm uses machine learning and artificial intelligence to study what users are viewing and to suggest other videos to them. With autoplay activated, as it is by default on YouTube, the service will continue delivering videos with similar themes and features indefinitely.

Former YouTube engineer Guillaume Chaslot, who left the company in 2013 and now runs the watchdog group AlgoTransparency, said YouTube will struggle to curb the flow of inappropriate content so long as its artificial intelligence is trained to maximize “watch time,” a metric that fuels the company’s advertising-driven business model.

The result, he said, is a recommendation system that prioritizes stimulating users above all else. In the recent scandal involving apparent pedophiles listing the time stamps of provocative images in video comment sections, Chaslot said the recommendation algorithm helped spread such content. “The best move for the [algorithm] is to find the videos for pedophiles and deliver them to the people who are most likely to become pedophiles. So the best artificial intelligence in the world is doing that.”

Federal privacy law also complicates the picture. Sites aimed at children younger than 13 are forbidden from gathering most types of personal data on users without parental permission. YouTube, which relies on data-driven advertising for its profits, avoids that restriction by maintaining that the service shouldn’t be used by children at all. If YouTube explicitly recommended certain content for children, that position would become untenable, Chaslot said.

Several consumer groups last year filed a complaint with federal regulators alleging that YouTube is aware that children regularly use the site, despite its policies, and as a result routinely violates the privacy law.

Chaslot argued that to make YouTube safer for children, the company needs to prioritize something other than “watch time,” ideally a system in which parents rate videos based on educational value or appropriateness rather than simply what children click on or watch automatically on autoplay. YouTube says it has reduced the emphasis on “watch time” in its recommendation algorithm.

Pediatrician Jenny Radesky, a University of Michigan researcher who examines the effects of advanced technology on children and families, said kids struggle to understand some of the videos, particularly when characters they admire act in inappropriate ways. This challenges their emerging sense of right and wrong and causes confusion. It may also cause some kids to imitate the behaviors they see, Radesky said.

But the strain on parents is serious, as well, as they seek to protect their children from troubling images and messages that always are as close as the nearest mobile device. Many parents say they find constant monitoring impractical and content controls limited and difficult to use.

“This is hard. It’s putting so much of the onus on parents to be monitoring and watching with kids,” Radesky said. “It needs a design fix.”

Sen. Edward Markey (D-Mass.) said he soon will propose legislation to treat online children’s content more like traditional children’s television. He favors requiring labeling for age appropriateness of videos to help families make viewing decisions and wants to scrutinize the use of design features, such as autoplay, that encourage especially heavy or even compulsive consumption.

“There’s extremely strong evidence showing that algorithms push content on YouTube that’s age-inappropriate for kids, and that’s not okay,” Markey said. “YouTube is where kids go. So we have to solve the problem. … We have to put rules in place to protect kids.”

Reiser, the Oakland mother whose 9-year-old found inappropriate videos, said her recent discoveries have made her want to block the platform from her home. “Because of all the creepy, weird stuff he’s finding, we’re actually watching YouTube less. I deleted it from the TV, and I’m deleting it from my iPhone.”

Elizabeth Dwoskin in San Francisco and Tony Romm contributed to this report.