Photo

In 2009, Carl C. Icahn bought a stake in Forest Laboratories, then a struggling drug maker.

Over the next few years, Mr. Icahn drew from his standard activist playbook. He criticized Forest’s management and ran a proxy contest to shake up its board. It took several rounds of trying, but Mr. Icahn eventually got two of his nominees elected. And last September, Forest hired a new chief executive, Brenton L. Saunders.

Now, less than a half-year after taking the helm, Mr. Saunders, at the urging of Mr. Icahn, has agreed to sell Forest for $25 billion in cash and stock. The merger will make Mr. Icahn even richer, while creating a huge pharmaceuticals company with heavy exposure to both branded and generic drugs.

Related Links Document: Press Release

The buyer is Actavis, one of the pharmaceutical industry’s most aggressive acquirers. Actavis, based in Dublin but operating from Parsippany, N.J., will pay $26.04 in cash and 0.3306 of one of its shares for each share of Forest, for total consideration of $89.48 a share. That represents a premium of 25 percent from Forest’s closing stock price on Friday.

“This is a huge win for all shareholders of Forest Labs and yet another validation of the activist investment philosophy in general,” Mr. Icahn said in a statement on Tuesday.

Shares of Forest closed up 27.5 percent on Tuesday, while Actavis shares were up 5 percent as investors cheered news of the deal.

Mr. Icahn stands to do particularly well, with profits of about $1.7 billion. His 11 percent stake in Forest, bought over several years for about $1.06 billion in total, will be worth about $2.7 billion in cash and stock.

In a statement, Mr. Icahn pointed out that shareholders who acquired Forest stock when he first bought shares in the company in 2009 would have realized a 209 percent gain in their investment.

“Throughout our campaign, we consistently maintained that Forest must either become much larger or be acquired to realize its full potential,” he said.

Forest’s best-known products are Lexapro and Namenda, two lucrative brand-name drugs. Through the deal, those drugs and other Forest products will become part of Actavis, a rapidly expanding company that started out as a generic drug maker.

Executives believe that as a combined company, Forest and Actavis will complement each other, balancing generic and branded drugs, benefiting from more marketing resources and offering a full suite of products in greater volume to hospitals and retailers.

The deal — Actavis’s largest acquisition by far — will be its seventh since January 2013, according to Standard & Poor’s Capital IQ. The combined revenue of the two fast-growing specialty pharmaceutical companies is expected to be more than $15 billion in 2015, the companies said.

“The consolidation in the pharmaceutical industry is necessary,” Paul Bisaro, the chairman and chief executive of Actavis, said in an interview. “The pricing pressure and the costing structures are going to require people to pull together.”

This was the first major deal Actavis announced since completing its takeover of Warner Chilcott last year for about $5 billion. That deal expanded Actavis’s presence in specialty pharmaceuticals, and also allowed it to complete a so-called tax inversion, relocating its headquarters to Ireland and escaping the American tax regime.

One big advantage of tax inversions, besides a lower statutory tax rate, is that deals can become more affordable. Once inverted, companies can more easily use overseas cash to pay for a deal, and the earnings from any acquired company are also taxed at the company’s new, lower rate.

In this case, Forest’s earnings, which had been getting taxed at a higher United States rate, will eventually be taxed at the lower Irish rate currently paid by Actavis, which executives estimated to be 16 percent. Tax savings will amount to at least $100 million, the companies said.

“The inversion probably was the factor that made the acquisition possible,” said Robert Willens, a corporate tax adviser. “By offering the benefits of a lower tax rate, Actavis made itself a very attractive suitor, and one that has a huge advantage over U.S. suitors.”

Mr. Bisaro, who will lead the combined company, said that the deal would result in at least $1 billion in pretax and tax savings in the first years of the combination.

The deal came together quickly. Mr. Bisaro and Mr. Saunders met in mid-January to discuss industry trends, but soon began to talk about combining their companies.

During the last few weeks, Mr. Saunders spoke with Mr. Icahn several times, according to people briefed on the negotiations. Mr. Icahn supported a sale of Forest.

Actavis is known for making speedy deals, and Mr. Bisaro said this one was no exception. “In today’s environment with the leaks, if things don’t come together quickly they don’t come together at all,” he said.

By using a mix of cash and stock to pay for the deal, Actavis was able to strike a deal for Forest without saddling its balance sheet with too much debt. Mr. Bisaro said it was important for the combined company to remain investment grade, partly so it could continue doing more deals.

And though Actavis has been known to grow through acquisition, the company is already pledging to develop new drugs aggressively after the merger. The combined company will spend $1 billion in research and development in its first year, executives said, and already has many products in later research stages.

The stock component was also important because Mr. Saunders and Forest executives also wanted to participate in the upside of the combined company, rather than just sell out. Forest shareholders will own about 35 percent of the combined company after the deal is completed.

The companies anticipate closing the deal during the middle of next year, and do not expect to have to sell any significant assets.

Mr. Saunders will stay on in some capacity, and is already being pegged by some as a successor to Mr. Bisaro. He joined Forest last year after running Bausch & Lomb, which he sold to Valeant Pharmaceuticals International for $8.7 billion.

The $25 billion transaction is the latest megadeal of the year, coming less than a week after Comcast agreed to buy Time Warner Cable for $45 billion, and just over a month after Suntory of Japan agreed to buy Beam for $13.6 billion.

Greenhill & Company and the law firm Latham & Watkins advised Actavis. JPMorgan Chase is serving as financial adviser to Forest, and Wachtell, Lipton, Rosen & Katz is serving as its legal adviser.

While Mr. Icahn applauded the deal, he could not resist taking one last dig at Forest’s previous management and the investment bankers that advised against his activist campaign.

“As well as Forest shareholders have done here partially as a result of our efforts, the shame is that the fighting could have been avoided and shareholders could have realized even more value had the company’s advisers been more interested in bringing the parties together rather than burnishing their own brand as ‘defense’ wizards,” he said.

“But to quote Shakespeare,” he added, “ ‘All’s well that ends well.’ ”