The waiting game is over: Verizon officially announced an agreement to acquire Yahoo’s flagging Internet search, media, communications and advertising business for $4.83 billion in cash.

If it’s not exactly a match made in heaven, it’s a marriage of opportunity for both parties. Verizon will combine the operations of AOL with Yahoo, two longtime rivals that were subject of frequent merger rumors over the years, to expand its stable of online-media properties including the mobile-centric Go90 video service. Verizon snapped up AOL last May for $4.4 billion.

“Just over a year ago we acquired AOL to enhance our strategy of providing a cross-screen connection for consumers, creators and advertisers,” Lowell McAdam, Verizon chairman and CEO, said in announcing the deal. “The acquisition of Yahoo will put Verizon in a highly competitive position as a top global mobile media company, and help accelerate our revenue stream in digital advertising.”

In addition to the $4.83 billion in cash, under the terms of the deal Verizon will issue “cash settled” restricted stock units (RSUs) for Yahoo RSUs that are outstanding at the time the transaction closes. Those will amount to about $1.1 billion, according to Cowen & Co. analyst Colby Synesael.

The deal, subject to closing conditions including approval by Yahoo’s shareholders and regulators, is expected to close in the first quarter of 2017. Yahoo has a global audience of more than 1 billion monthly active users, including 600 million on mobile devices, through search, communications and digital content products. Yahoo claims its email services are used by 225 million monthly active users.

Under Verizon, Yahoo’s 21-year-old brand will live on. Some investors in the once-mighty webco — once worth north of $125 billion during the late-’90s Internet bubble — are sure to be unhappy with the price tag. Still, the company will find a home for many of its employees and technologies; Yahoo had a headcount of 8,800 at the end of June, a 20% reduction from a year prior.

Yahoo will be integrated with AOL under Marni Walden, Verizon’s exec VP and president of product innovation and new businesses.

Marissa Mayer, who has been Yahoo’s chief executive officer for the past four years and failed to execute on several turnaround strategies, for now will remain CEO of Yahoo — which will change its name after the close of the Verizon deal and become a publicly traded investment-holding company.

“Yahoo is a company that has changed the world, and will continue to do so through this combination with Verizon and AOL,” Mayer said in a prepared statement. “Yahoo and AOL popularized the Internet, email, search and real-time media. It’s poetic to be joining forces with AOL and Verizon as we enter our next chapter focused on achieving scale on mobile.”

The sale to Verizon does not include Yahoo’s cash, its equity investments in Alibaba Group Holdings or Yahoo Japan, Yahoo’s convertible notes, certain minority investments, or Yahoo’s non-core patents. Those assets will continue to be held by Yahoo, which set up an entity called Excalibur LLC to explore the sale of more than 4,000 “non-strategic” patents and pending applications. Currently, execs are referring to company without its operating businesses as “RemainCo”; Yahoo said it plans to return “substantially all of its net cash” to shareholders in the future.

AOL CEO Tim Armstrong, for his part, said in a statement, “Yahoo has been a longtime investor in premium content and created some of the most beloved consumer brands in key categories like sports, news and finance.” Under Armstrong, AOL has invested in content brands including the Huffington Post, TechCrunch and Engadget, and has launched programmatic ad-buying platforms.

Verizon has now bought two erstwhile Internet heavyweights, together worth well over $300 billion at one point, for less than $10 billion. AOL, which had a peak market cap of about $222 billion, had the clout to acquire Time Warner in 2000. In 2008, Yahoo rejected a $47 billion buyout bid from Microsoft, with the company’s board saying the offer substantially undervalued Yahoo.

“Among the many entities that showed interest in Yahoo, Verizon believed most in the immense value we’ve created, and in what a combination could bring our users, our advertisers, and our partners,” Mayer wrote in a memo to employees Monday, which was posted to Tumblr.

In the five-month-long auction process, Verizon beat out other bidders including AT&T, private-equity giant TPG and a consortium led by Quicken Loans founder Dan Gilbert, who is also majority owner of the Cleveland Cavaliers.

Under Mayer, a former top Google executive, Yahoo tried various strategies to drive revenue growth. Those include its $1.1 billion deal for Tumblr, which has not yielded hoped-for revenue returns and led Yahoo to write down most of its value in the past six months. Mayer also doubled down on building up Yahoo’s search business, investing millions in search deals and in mobile-search tech, on the belief that it was an area of critical importance for the company. But costs for the search business have risen faster than revenue in the segment.

Mayer additionally invested in high-priced talent — recruiting Katie Couric as global news anchor in deal reportedly worth $10 million, mostly in stock — to boost the company’s content output and keep users engaged longer on the site. At this point, it’s not clear if Couric will remain with Yahoo for much longer, or what she will do if she exits. Mayer also embarked on a strategy to acquire long-form entertainment, including season 6 of cult comedy “Community,” before pulling back on that last year.

Under the terms of Verizon’s deal with Yahoo, if the agreement is terminated Yahoo would pay a breakup fee of $144.8 million in certain circumstances (including if Yahoo nixes the pact to take a better offer), according to an SEC filing. The acquisition is not predicated on any performance targets for Yahoo’s business.

Yahoo’s name is an acronym that stands for “Yet Another Hierarchical Officious Oracle.” One of the earliest website directories, it was founded by Jerry Yang and David Filo, who were Stanford U. students at the time. Filo remains on Yahoo’s board (where his title is “Chief Yahoo”); Yang is founding partner of early-stage investment company AME Cloud Ventures.

One interesting wrinkle with the Verizon deal for Yahoo: Currently, Yahoo hosts email for AT&T’s customers. In May, AT&T ended its 15-year pact with Yahoo to operate the telco’s web and mobile portal sites and branded apps, with AT&T outsourcing those functions to Synacor.

Verizon is scheduled to report second-quarter 2016 earnings results on July 26, when execs will further discuss the Yahoo deal.