Japan's Takeda Pharmaceutical has struck a deal to buy Irish drugmaker Shire for £46bn after the two sides finally agreed the terms of the deal.

The agreement ends a takeover battle that had seen Takeda make five offers for UK-listed Shire since late March.

If the deal is backed by shareholders, it will be the largest overseas takeover by a Japanese company to date.

The deal is part of Takeda's strategy of becoming a global pharmaceutical company.

The Japanese firm wanted to buy Shire to strengthen its cancer, stomach and brain drug portfolios.

Takeda chief executive Christophe Weber said: "Shire's highly complementary product portfolio and pipeline, as well as experienced employees, will accelerate our transformation for a stronger Takeda.

"Together, we will be a leader in providing targeted treatments in gastroenterology, neuroscience, oncology, rare diseases and plasma-derived therapies."

Under the terms of the deal, Shire investors will receive $30.33 in cash for each share they own, plus shares in Takeda, making the total offer worth about £49 a share.

Up to three Shire directors will also join Takeda's board.

Shire chairwoman Susan Kilsby said: "We firmly believe that this combination recognises the strong growth potential of our leading products and innovative pipeline and is in the best interests of our shareholders, our patients and the communities we serve."

Shares in Shire rose 3% to £39.82 in early trade.