Dublin-based Shire Pharmaceuticals has accepted a €40bn takeover bid from US giant AbbVie, the two companies have said.

"The boards of AbbVie and Shire are pleased to announce that they have reached agreement on the terms of a recommended combination of Shire with AbbVie," the firms said in a statement.

On Monday Shire said it was ready to recommend the deal to shareholders after it AbbVie revised the terms for a fifth time.

The US pharmaceutical wants to buy Shire to reduce its dependence on rheumatoid arthritis drug Humira, which will US patent protection in 2016.

The deal will also allow it to invert its tax base to Britain – where Shire is listed – which will allow it to reduce its tax burden.

Analysts at Barclays have estimated the move would provide around $1.3bn in tax savings by 2020 as a result of Britain’s lower tax rate when compared to the US.