MIAMI — Gambling operator Penn National Gaming announced Wednesday that it was buying a minority stake in Barstool Sports, the popular and controversial sports media company, in a deal that values Barstool at $450 million and signals the shrinking gap between the sports-betting and sports-media industries.

The deal calls for Penn to increase its stake to around 50 percent in three years, with options to buy the entire company.

For Penn, which owns brick and mortar casinos in 19 states, Barstool will help reach a younger, gambling-savvy demographic. For Barstool, it’s a payday that rewards the company for leaning into gambling more aggressively than other sports media companies, and for cultivating a rabid following that devours its content, which can be both original and offensive.

“The question has been asked over and over again around how do you attract younger generations — Gen X, millennials,” Penn National CEO Jay Snowden said on a conference call Wednesday morning. “We have the opportunity with Barstool to do that now.”

Snowden said the average casino-goer is in their 50s and getting older, while a younger, more affluent demographic is growing more interested in sports betting. In 2018, the Supreme Court overturned a decades-old law that limited most legal sports gambling to Nevada, paving the way for states to legalize sports betting. Twenty states have passed legislation to legalize sports gambling in some form, according to the industry website Legal Sports Report, with more state legislatures considering bills.

The Penn-Barstool partnership will integrate Penn gambling information into Barstool content with the goal of driving consumers to Penn’s physical casinos and online products. Snowden said there are also plans to launch Barstool-branded casinos that will focus on poker and sports betting. He added that key Barstool stakeholders — including founder Dave Portnoy, CEO Erika Nardini and popular podcast host Dan Katz — are now significant shareholders in Penn and have signed new long-term deals.

Nardini and Portnoy will maintain editorial control of the site for now, Snowden said.

Barstool was founded by Portnoy in 2003. Initially, he printed a newspaper and distributed it for free around Boston. His antics — including getting arrested at NFL headquarters after a sit-in to protest the punishment of Tom Brady — helped build Barstool’s rabid following. In 2016, holding company The Chernin Group paid $10 million for a stake in the company, and later invested another $15 million. Today, Barstool has a series of popular podcasts, including “Pardon My Take,” hosted by Katz and Eric Sollenberger, which regularly hosts stars such as football players Baker Mayfield and George Kittle.

Barstool also has a history of troubling behavior that has kept it from mainstream acceptance. Its fans have routinely harassed female journalists, and when ESPN commissioned a Barstool show in 2017, it was canceled after a single episode amid furor over a professional association with Portnoy, who once said an ESPN host should “sex it up and be slutty,” among other degrading comments. Portnoy recently reached a settlement with the National Labor Relations Board, after publicly threatening to fire employees who discussed organizing a Barstool union.

According to one sports media executive, Barstool had conversations with several sports media companies about an acquisition, but its history and the certain blowback to any association made any deal impossible.