Idenix Pharmaceuticals (UNKNOWN:IDIX.DL) nearly became a footnote in the hepatitis C drug race a few years ago when Bristol-Myers Squibb's buyout of Inhibitex imploded, kick-starting a series of events that led the FDA to slap clinical holds on two of the Cambridge, MA-based company's drug prospects. Those who stayed with Idenix through the tough times are reaping the rewards today, however, as Merck (NYSE:MRK) has agreed to buy the company in a $3.85 billion deal.

Merck is paying a whopping $24.50 per share, all in cash, for the rights to Idenix —a more than 230 percent premium to the company's $7.34 per share closing price on Friday. Both companies' boards have approved the deal, which is expected to close in the third quarter.

The deal marks an outcome that wouldn't have seemed possible only a couple of years ago. Idenix is one of a number of companies trying to whip up drugs that would be part of all-oral cocktail regimens for hepatitis C, which are replacing interferon-based therapies. But in August 2012, the FDA slapped clinical holds on Idenix's two most advanced compounds, IDX184 and IDX19368. Both drug candidates shared certain structural similarities to the drug Bristol-Myers got when it acquired Inhibitex—a drug that was linked with such serious safety concernsin a mid-stage trial that Bristol terminated the study, tossed the compound, andwrote off the Inhibitex deal. Shortly after the Bristol revelation, the FDA put holds on the two Idenix drugs, requesting all sorts of tests to ensure they were safe. Idenix shares were slammed, and the company had to regroup.

Idenix pivoted, and focused on some other prospects in its pipeline, like IDX-719, a so-called NS5A inhibitor now known as samatasvir, and preclinical drug candidates IDX21437 and IDX21459. Though it would have no shot to be part of the first wave of new hepatitis C therapies—Gilead Sciences, for instance, won FDA approval of sofosbuvir (Sovaldi) last year, and other drugs from AbbVie and Enanta Pharmaceuticals are coming—Idenix hoped to ultimately produce drugs that could be part of regimens for all subsets of hepatitis C patients, and thus compete with the Gileads and AbbVies of the world. (It's also sued Gilead for patent infringement, as has Merck.) Merck, which is developing a group of next-wave hepatitis C drugs of its own, is buying into that strategy today.

"Idenix has established a promising portfolio of hepatitis C candidates based on its expertise in nucleoside/nucleotide chemistry and prodrug technologies," said Merck research chief Roger Perlmutter (pictured above), in a statement. "Idenix's investigational hepatitis C candidates complement our promising therapies in development and will help advance our work to develop a highly effective, once-daily, all oral, ribavirin-free, pan-genotypic regimen that has a duration of treatment as short as possible for millions of patients in need around the world."

This article originally appeared on Xconomy, along with:

Ben Fidler has no position in any stocks mentioned. The Motley Fool recommends Gilead Sciences. The Motley Fool owns shares of Gilead Sciences. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.