It started with Jerry Yang, the co-founder of Yahoo. Very early in the company’s history, in 1996, he had made the aforementioned Yahoo Japan partnership with Japanese entrepreneur Masayoshi Son of Softbank. It proved very successful. Almost a decade later, Yahoo wanted to do the same sort of thing in China. But it was failing in its original efforts.

“China turned out to be a very different place,” says Yang. “We were not doing well, struggled with acquisitions there. We were looking to parlay an operational role, where we rely on a partner, invest and be along for their ride.”

Jack Ma and Jerry Yang at Pebble Beach, 2005.

Yahoo’s CEO at the time, Terry Semel, and his COO, Dan Rosensweig, told Yang to pick a partner. One Chinese company in particular was beating Yahoo soundly in e-commerce — Alibaba, led by a hustling businessman named Jack Ma and his chief financial officer, Joe Tsai. “It was fairly obvious to choose,” says Yang. The deal was cooked up on the Pebble Beach golf course in 2005, with Yahoo investing $1 billion for 40 percent of Alibaba. “We were in the right place in the right time,” he says. “It was probably good that we had been failing in China.”

That’s for sure. Because over the next few years, as Yahoo’s fortunes and stock price faltered, Alibaba grew bigger and bigger. And the value of Yahoo’s stake skyrocketed. As the roles reversed, the relationship took on a “Star is Born” aspect. Alibaba naturally was unhappy that a declining enterprise owned such a huge share of its value. And Yahoo became more and more dependent on its Alibaba stock. In 2008, when Microsoft made a hostile bid for Yahoo, Yang was determined to fend it off—largely because he knew how valuable the Alibaba stock would be. “I am happy that the company had an asset, a buffer to allow its reinvention,” he says.

But in some ways the Alibaba stake became a mixed blessing, and in recent years the struggles over it have changed the cinematic analogy to “The Treasure of the Sierra Madre.” Because Yahoo held such a valuable, yet undervalued asset locked within its corporate balance sheet, some investors jumped in, sensing a bargain. But they had specific ideas on what Yahoo should or should not do with the money. Those ideas generally tilted towards giving money back to shareholders like themselves; often these new investors found themselves at odds with the people trying to run Yahoo’s actual business. There were fears that they were actually plotting with Alibaba to take over Yahoo. And each subsequent Yahoo CEO would find that trying to thwart those investors was a dangerous game.

One investor came early to the realization that Yahoo’s Alibaba holdings eclipsed its actual business. He was a small stakeholder named Eric Jackson who had been a thorn in Yahoo’s side for several years: in 2007, he had led a shareholder revolt that arguably hastened the departure of then-CEO Terry Semel. In 2010, Jackson visited Hong Kong and won a rare meeting with Alibaba’s CFO, Tsai. “His ulterior motive was that he was having difficulties with Carol Bartz [who had become Yahoo’s CEO],” says Jackson. While Tsai railed against Yahoo’s refusal to sell back shares to Alibaba, Jackson was able to learn about Tsai’s company. “My eyes were as big as saucers,” he says. He realized that this Chinese company was about to become huge—and Yahoo’s holdings were way out of proportion with the value of its core business.

Jackson joined forces with a much richer player, hedge fund manager Daniel Loeb of Third Point. Loeb took a big share of Yahoo and began pushing for Yahoo to sell shares back to Alibaba and give cash back to shareholders. This synced perfectly with Jack Ma and Joe Tsai’s desires.

The CEO of Yahoo at that point was Scott Thompson. (Yes, we have moved only a few months in our narrative and there is another Yahoo CEO. Scorecards sold in the lobby.) Because Thompson was resisting a sell-off, Loeb wanted him out—and by discovering and exploiting inaccuracies in Thompson’s resume, Loeb succeeded. Thompson resigned in May 2012.

The interim CEO who took Thompson’s place, hoping to pacify Loeb and perhaps prevent a takeover, then agreed to the deal that Loeb and Alibaba wanted. For Yahoo, it was a catastrophic arrangement. Yahoo would sell back 535 million shares, around half its stake, at $13 a share, for a total of around $7 billion. Had Yahoo not sold, the value of those shares would eventually have been worth $45 billion. Worse, it was a taxable transaction and almost half of Yahoo’s proceeds evaporated instantly. Eighty-five percent of the after-tax amount went to shareholders. Only the remaining crumbs went to Yahoo’s cash reserves.

That wasn’t all. The deal specified that when Alibaba went public, as was expected in a few years, Yahoo would be bound to sell 261 million more shares, half of its remaining stake. At that point the shares would be on a steep rise; selling at that point would violate investment wisdom. And once again, Yahoo’s proceeds would be taxable.

The deal was completed in September 2012. By then Marissa Mayer was CEO. To say her team was chagrined at the arrangement was an understatement. “Being forced to sell half our stake at the IPO was an unmitigated financial disaster,” says Jackie Reses, whom Mayer hired as Yahoo’s chief development officer.

Mayer knew how important it was for Yahoo to repair its relationship with Alibaba, which in Reses’ description “had gone down a toxic path and fractured.” Mayer appointed Reses to be Yahoo’s representative on Alibaba’s board. Reses previously had been with a private equity firm, so she had experience in high finance.

“I focused on Alibaba everyday,” says Reses. “Very few days would go by—very few hours would go by—where I wasn’t paying attention to what was happening to Alibaba.” She regularly flew to China, honoring the Alibaba team by seeing them on their home turf.