Specialty pharmaceutical company Forest Laboratories said Wednesday it has agreed to pay $2.9 billion in cash to acquire Aptalis Pharma from the latter’s shareholders, including private equity firm TPG.

TPG acquired Aptalis—which specializes in drug treatments for cystic fibrosis and other gastrointestinal disorders—for $1.3 billion in 2007, when the company was called Axcan Pharma. Axcan’s purchase of Eurand four years later resulted in the company changing its name to Aptalis. The company generated $687.9 million in revenues during the last fiscal year.

Reuters reported last summer that TPG was conducting a sale process in which it was seeking more than $3 billion for Birmingham-based Aptalis—a price tag at which several bidders apparently balked. After initially failing to reach a deal, TPG opted for a dual-track process last month by filing for an initial public offering for Aptalis. The IPO was expected to raise up to $500 million, but TPG was ultimately able to strike a deal with Forest before moving forward with the planned offering.

In announcing the deal, Forest said Aptalis complements its own product offerings, and it expects roughly $125 million in annual savings by 2016. New York–based Forest markets a range of drug products, including treatments for gastrointestinal diseases. The acquisition of Aptalis is expected to close in the first half of this year, pending regulatory approval. The deal will be reviewed by antitrust authorities in the U.S. as well as Canada, where Aptalis has some of its operations.

Debevoise & Plimpton is advising Forest on the acquisition, while Cleary Gottlieb Steen & Hamilton is serving as financing counsel to the company. Debevoise’s team is led by New York–based corporate partner Andrew Bab and also includes tax partner Gary Friedman, finance partner Pierre Maugüé, litigation partner Andrew Levine, corporate counsel Judith Church, litigation counsel Kristin Kiehn and IP counsel Carl Riehl. A. Robert Bailey serves as general counsel for Forest.

In 2009 Debevoise represented Forest and its subsidiary, Forest Pharmaceuticals, in its settlement of civil and criminal investigations brought by the U.S. government in connection with the company’s illegal distribution and promotion of unapproved drugs for pediatric depression. Forest Pharmaceuticals eventually pleaded guilty to charges of obstructing justice and illegal distribution while agreeing to pay more than $313 million to resolve the matter.

Cleary corporate partners Jeffrey Karpf and Margaret “Meme” Peponis are leading that firm’s New York–based team advising Forest on financing aspects of the deal. Associate Anna Kogan and law clerks Younghee Chung and Rachel Gibbons are also working on the matter at Cleary.

For its part, Aptalis and TPG have turned to Ropes & Gray for legal advice on the sale. Ropes has a long history with TPG, having advised the buyout firm on numerous past transactions, including a $1.9 billion purchase of generic drug maker Par Pharmaceuticals in July 2012. Later that year, TPG also turned to Ropes for legal advice in connection with the sale of medical equipment supplier Fresenius Kabi to Fenwal Holdings in a deal reportedly worth $1.1 billion.

The Ropes team working on the sale of Aptalis includes Boston-based corporate partner William Shields, securities partner Patrick O’Brien, private equity partner Michael Roh, tax partner Loretta Richard, antitrust partner Michael McFalls, securities partner Christopher Green and finance partners Jay Kim and Alexander Zeltser. Richard Maroun serves as general counsel for Aptalis.