NBCUniversal has set a deal to buy DreamWorks Animation for $3.8 billion in cash, giving the Comcast-owned media conglomerate added heft in its effort to compete with rivals like Disney, Time Warner and Viacom, all of which cater more directly to kid-and family audiences.

The deal values DreamWorks Animation at $41 a share, a rich premium over the company’s recent trading levels. The total equity value of the deal, including debt, is $4.1 billion. Shares in the smaller company surged nearly 25% in earlier trading after the announcement was made.

DreamWorks Animation will become part of NBCUniversal’s Universal Filmed Entertainment Group. Chris Meledandri, head of Universal’s Illumination Entertainment animation wing, will oversee operations. The DreamWorks Animation brand will remain intact as an imprint.

After the sale closes, DreamWorks Animation CEO Jeffrey Katzenberg will become chairman of DreamWorks Animation New Media, comprising its ownership stakes in AwesomenessTV and Nova, which will be part of NBCUniversal although it’s unclear where the unit will be housed within the company. Katzenberg will also serve as a consultant to NBCUniversal. Though he remains committed to his work with Comcast, those close to Katzenberg expect he will remain active in his own business endeavors independent of that cable giant.

DreamWorks will help us grow our film, television, theme parks and consumer products businesses for years to come,” said NBCUniversal CEO Steve Burke. ” We are fortunate to have Illumination founder Chris Meledandri to help guide the growth of the DreamWorks Animation business in the future.”

The deal is expected to close by the end of the year. There is a $200 million breakup fee if the pact falls apart and does not receive regulatory approval, according to public filings. DreamWorks Animation marks the latest investment in a major entertainment content engine by NBCUniversal parent Comcast, the cable giant that took over the Peacock from GE in 2011.

“This agreement not only delivers significant value for our shareholders, but also supports NBCUniversal’s growing family entertainment business,” Katzenberg said. “As for my role, I am incredibly excited to continue exploring the potential of AwesomenessTV, NOVA and other new media opportunities, and can’t wait to get started.”

The deal marks a significant up-charge over DreamWorks Animation’s $2.79 billion market cap and allows the studio behind “Shrek” and “Kung Fu Panda” to become part of a sprawling media conglomerate. It struggled in recent years to operate as a publicly traded, pure play studio, with its stock given to rise and, more often, fall following every film release. Rivals, such as Disney and Warner Bros., are all parts of heavily diversified media conglomerates that enable them to be less dependent on box office results.

“It’s gotten difficult to be an independent studio,” Tuna Amobi, an analyst with S&P Capital IQ, told Variety shortly after reports broke that talks were taking place between the companies. “Wall Street doesn’t like the uncertainty. This allows DreamWorks to be part of a larger company. The access to the huge resources helps it given the importance of scale today.”

Katzenberg had been trying to sell the company for years. Toy company Hasbro had been in talks to acquire the studio in a deal worth at least $2.3 billion, but talks collapsed in November 2014. Japanese conglomerate Softbank also kicked the animation company’s tires in September 2014, but no deal materialized.

He has also worked to broaden DreamWorks Animation’s offerings, snapping up AwesomenessTV, which is a major force in digital video, and Classic Media, the makers of “Casper the Friendly Ghost” and “Lassie.”

The acquisition bolsters NBCUniversal’s family entertainment offerings, potentially allowing them to plug in DreamWorks Animation’s cartoon characters across Comcast’s array of theme park, children’s television programming and merchandising holdings. Combined with Illumination’s output, the studio could release as many as four major animated films annually, challenging Walt Disney Studios in the animation space. Fully integrating the studios may take a few years. DreamWorks Animation has a distribution pact with 20th Century Fox the runs through 2017.

In terms of other high-profile acquisitions, the DreamWorks Animation deal is slightly more than the $4 billion Disney paid for LucasFilm in 2012 and the $3.96 billion it shelled out for Marvel in 2009, though it trails the $7.6 billion that Disney paid for Pixar in 2006.

In filings, Comcast said that the deal will not impact its plans to repurchase $5 billion worth of common shares this year.