Here’s Why Verizon Decided to Stick With Yahoo Despite Everything

Not just one massive data breach, in which hundreds of millions of user accounts were compromised, but two of them— combined with a failure to mention either attack for months or even years. That’s what Yahoo has admitted to.

And yet, Verizon seems to want to acquire the company for $4.5 billion anyway. The two companies announced an agreement on Monday to cut the original price of their deal by $350 million, and to share the costs of any future legal ramifications of the breaches, which have yet to be determined. But the deal is going ahead.

Word about the hacks only became public after Verizon made its original acquisition offer for Yahoo. So why didn’t Verizon use that new information to cancel the deal and move on?

You could have asked a similar question even before the hacks were made public. After all, Yahoo was arguably a failing business with declining brand value and seemingly very little to offer, despite its long history. Why bother acquiring it at all?

Get Data Sheet, Fortune’s technology newsletter.

The answer to both of these questions is the same. The bottom line is that Verizon doesn’t really have a choice. If it wants to build a mobile-first digital advertising business that can go head-to-head with Facebook and Google—and it very much wants to do that, because its core telecom business is in decline—Yahoo is just about the only option.

Its brand may be failing, but Yahoo has about a billion users who come for its weather and other services, including lucrative audiences like the ones who use Yahoo to get their online sports news and run their fantasy football leagues.

Much like AOL, which Verizon also acquired in 2015 for $4.4 billion, Yahoo has been trying to build a mobile and digital ad marketplace that can use the data it has accumulated about all of those users. It hasn’t been able to build it quickly enough to save the company, but that data and those ad platforms are still worth something.

What Verizon is hoping is that it can combine AOL’s mobile and digital ad business, which former AOL CEO Tim Armstrong is in charge of, with similar businesses acquired from Yahoo. The goal is to create the kind of heft and market intelligence needed to compete with Facebook and Google.

Regardless of the huge price tag, it’s an open question whether Verizon will be able to do this. Merging AOL and Yahoo will be hard enough, but competing with Facebook in particular could be almost impossible. The company controls almost 15% of the digital ad market, and Yahoo and AOL combined have about 2%.

While it’s true that Yahoo has hundreds of millions of users, the company doesn’t have anywhere near the kind of granularity of data on those audiences that Facebook has. The giant social network has a vast amount of behavioral information on the things that its nearly 1.8 billion users are interested in—what they say, what they click on, what they share, and so on.

That’s a compelling pitch for advertisers looking to target specific users or audiences, and it’s one that Verizon is going to have a hard time beating. But if it is to survive, it will have to try. And acquiring Yahoo, as injured as it might be, is about the only chance the telecom company has of getting there.

Subscribe to the Eye on AI newsletter to stay abreast of how AI is shaping the future of business. Sign up for free.