US generic drugmaker Perrigo has agreed to buy Dublin based drug company Elan for $8.6 billion in a deal that will hand it royalty rights from a blockbuster treatment.

Elan put itself up for sale last month after rejecting three hostile bids from US investment firm Royalty Pharma in a bitter takeover battle that involved injunctions, court hearings and a war of words.

Michigan-based Perrigo manufactures over-the-counter pharmaceutical products for the store brand market.

It will pay $6.25 per share in cash and $10.25 per share in stock, a premium of about 10.5% over Elan's closing price on Friday. 

Elan shares ended the day 3.7% higher at €11.55 on Dublin's ISEQ, after jumping over 10% at one stage today. 

"We're excited by what it means for the international expansion. We think it's financially compelling and when you put it together with an Irish domicile that has operational tax synergies, we think it's a really compelling story," Perrigo chief executive Joe Papa said.

''This is an excellent transaction for Elan shareholders and provides them with cash consideration as well as the opportunity to benefit from the potential upside value of the new company,'' commented Elan's chairman Robert A Ingram.

Elan's CEO Kelly Martin said that the company platform has been constructed over the years to provide ''a unique and compelling investment thesis for our shareholders''.

''This transaction underscores the tremendous value of Elan's platform. The new combined company should deliver value, growth and diversification to shareholders for many years to come,'' he added.

Reuters reported last week that Perrigo and New York-based Forest Laboratories were preparing to submit takeover bids and that Elan hoped to announce a sale as early as this week.

The proposed deal, which has been unanimously approved by the boards of directors of Perrigo and Elan, is expected to close by the end of the year.

Elan, which was founded as a private company in 1969, had also drawn initial interest from Allergan, Mylan International and Endo HealthSolutions.

For Elan and and its chief executive Kelly Martin, who took over the firm in 2003 when its share price had sunk to $2, the deal is vindication for rejecting Royalty's advances as consistently undervaluing the company.

Royalty's final offer was $13 in cash per share as well as a "contingent value right" that could have added a further $2.50 per share if Elan's blockbuster multiple sclerosis drug Tysabri hit certain sales milestones. "I think the value is fair for Elan, it's fair for Perrigo," Mr Martin told Reuters.

Some Elan investors speculated that any industry buyer could acquire Elan and sell a portion of the royalties on Tysabri to Royalty, which is what the investment firm had wanted all along.

Elan sold its 50% interest in Tysabri to US partner Biogen Idec in February for $3.25 billion but retained royalty rights in the drug, whose sales rose to $1.6 billion last year.

Papa said that he saw the Tysabri royalty, worth up to 25% on future sales, as a very good source to fund future opportunities for the company.