SAN FRANCISCO -  Yahoo sealed a deal Monday to sell its core business to telecom giant Verizon for $4.8 billion, ending a two-decade run as an independent company for the internet pioneer.

The agreement announced by the two companies after months of negotiations comes following a years-long decline for the iconic firm that introduced many people around the world to the internet.

Verizon chief executive Lowell McAdam said Yahoo would be integrated into its recently acquired AOL unit to create "a top global mobile media company, and help accelerate our revenue stream in digital advertising."

The acquisition, expected to close in early 2017, pending shareholder and regulatory approval will exclude Yahoo's cash, certain patent holdings, and its big share in China's Alibaba Group and stake in Yahoo Japan.

The deal will, however, turn over the popular Yahoo News, Mail and other online services used by more than a billion people worldwide.

Marissa Mayer, CEO of Yahoo, said in a statement: "Yahoo is a company that has changed the world, and will continue to do so through this combination with Verizon and AOL."

She told a conference call that the agreement is "an exceptional outcome for Yahoo shareholders" and that Verizon was chosen because it "believed in us the most."

With the sale of its core, Yahoo will be left as a separate investment company that will change its name after the transaction.

The deal comes with Yahoo, a onetime leader in the online space, coping with years of decline and struggling to keep up with rivals like Google and Facebook.

Mayer said in a blog post that Verizon "brings clear synergies to the table" with its goal of reaching a global audience of two billion by 2020.

"Joining forces with AOL and Verizon will help us achieve tremendous scale on mobile," she said.

"It's incredibly compelling."

Yahoo will operate independently until the acquisition and then fall under the aegis of the AOL unit chief, Tim Armstrong, a former Google colleague of Mayer.

"Yahoo has been a long-time investor in premium content and created some of the most beloved consumer brands in key categories like sports, news and finance," Armstrong said in the statement.

Mayer's future role with Yahoo was unclear.

In an email to employees, she wrote that "I'm planning to stay... It's important to me to see Yahoo into its next chapter."

But it was not clear if she would remain after the transition. According to documents filed with regulators, Mayer would get a severance package of $55 million if removed within a year of a change of control.

Mayer arrived in 2012 from Google seeking to revitalize Yahoo, which at its peak had a market value of over $100 billion.

The company was founded in 1994 by two Stanford University students, Jerry Yang and David Filo, as "Jerry and David's Guide to the World Wide Web." It went public in 1996 in one of the most hotly anticipated stock offerings of the time -- surging 270 percent in the first day of trading.

Yahoo remains a major force online, but has lagged its rivals in its ability to "monetize" its audience through advertising that is linked to customers' browsing and other online activities.

The research firm eMarketer estimated that Yahoo's share of the digital advertising market would fall this year to around 1.5 percent, with Google getting some 30 percent and Facebook 12 percent.

Several other bidders have been in talks, according to reports, including Quicken Loans founder Dan Gilbert, who was being backed by billionaire Warren Buffett.

- Verizon strategy -

But Verizon appeared to be the leading candidate because of its ability to integrate AOL's advertising technology into Yahoo services.

Technology analyst Jack Gold of J. Gold Associates said the deal makes sense with companies such as Verizon and AT&T seeking to move beyond their role as mere carriers.

Verizon, he said "is looking at ways to stay competitive primarily with AT&T" and that Yahoo gives it "the ability to expand into the online content arena" and a large base of users.

But Roger Kay of Endpoint Technologies Associates said Verizon should keep its goals more modest and may get a small benefit from the Yahoo brand.

"I don't think they have enough juice to take down Google and Facebook," Kay said.

With better operating efficiencies and lower costs, "they'll be lucky if they get their money back" from the deal, he said.

Shebly Seyrafi at FBN Securities said Verizon could be looking at a broader internet strategy and may become "a serial acquirer which could then spur bidding wars for other internet properties."

This could mean Verizon may "eventually bid for Twitter" or private companies such as Snapchat or Pinterest, Seyrafi said in a note to clients.

Mayer has been under pressure from shareholders to "unlock" value for Yahoo, whose core business has been effectively held a zero or negative value.

Yahoo had a $37 billion market value at the end of trade Friday, but its Alibaba and Yahoo Japan holdings are estimated to be worth $40 billion or more.