Dan Loeb, the activist investor who led the charge to oust former Yahoo CEO Scott Thompson and replace him with Google veteran Marissa Mayer, is making his exit from the company's board, and taking a twofold profit with him.

Loeb bought up a 6 percent stake in Yahoo during the fall of 2011 and spring of 2012, purchasing most of the stock for around $15 a share. Along with forcing out Thompson, Loeb pushed for Yahoo to sell some of its stake in the Chinese internet giant Alibaba. After he joined the board, Yahoo sold 7 percent of its stake in Alibaba, giving it $7 billion in cash to make acquisitions and buy back stock.

Over the last year, even as its core business continued to erode, the company's shares have surged, buoyed by Mayer's leadership and stock buybacks. Today Yahoo announced it would repurchase 40 million shares of common stock from Loeb's firm at $29.11 a share, a total of $1.164 billion.

A former Yahoo executive, speaking on the condition of anonymity, said that Loeb's departure was not unexpected. "Yahoo could have gone two ways after Scott Thompson: a media company under Ross Levinsohn or tech company under Marissa Mayer." Yahoo currently generates most of its revenues on the media and advertising side. It has steadily lost ground to other tech giants like Google in the search and email market.

"For Yahoo, Marissa was the riskier move."But Loeb pushed hard for Mayer because the stock market typically values tech companies at a higher price-to-earnings ratio than media companies. "Ross would have been the slow steady choice, the long term choice," said this executive. "For Yahoo, Marissa was the riskier move."

Viewed through this lens, Loeb's departure looks like a quick flip. He is selling the majority of his stake in Yahoo and leaving the board along with the two men he nominated, Michael Wolf and Harry Wilson. "Loeb leaves a lot richer. Yahoo has a great new CEO," the executive noted. "But it's not clear that, in the long term, it can really compete with the new breed of tech companies."

The repurchase of Loeb's shares represents a big chunk of the $1.9 billion in share buybacks Yahoo had promised, leaving $700 million in buybacks which the company says it plans to continue executing on.