U.S. property and casualty insurer Alleghany Corp said it would buy reinsurer Transatlantic Holdings for $3.4 billion in cash and stock, a day after a source told Reuters that Alleghany was close to a deal for the company.

The agreement puts an end to the months-long buyout battle for Transatlantic, which has been courted by Allied World Holding , Validus Holdings Ltd , National Indemnity, a unit of Warren Buffet's Berkshire Hathaway among other suitors.

Under the terms of the deal, Transatlantic shareholders will receive $14.22 in cash and 0.145 Alleghany shares for each share, for a total value of $59.79 per share.

The price is at a premium of about 10 percent over Transatlantic's Friday close of $54.43 on the New York Stock Exchange.

Alleghany was expected to pay $59-$60 per share in cash and stock for Transatlantic, a source had told Reuters.

A deal with Alleghany could help Transatlantic ward off rival Validus, which has gone hostile in its attempt to buy the company.

Validus last offered to buy Transatlantic for around $55.35 per share and was also seeking to remove seven incumbent Transatlantic directors and have three of its nominees elected to the target company's board.

Alleghany said Joseph Brandon, former chief executive of Berkshire Hathaway's General Re Corp, would join the company.

Reuters had earlier reported that Brandon was working with Morgan Stanley on a possible bid for Transatlantic.

Transatlantic is one of the cheapest companies in the industry and its long-tail insurance lines -- such as medical malpractice and workers' compensation -- are attractive to rivals more exposed to short-tail risks such as hurricane damage.

Davis Selected Advisors, Transatlantic's largest shareholder and a vocal opponent of other offers for the company, supported the merger, Alleghany said.

Shares of Transatlantic closed at $54.43 Friday on the New York Stock Exchange.

(Reporting by Tanya Agrawal and Jochelle Mendonca in Bangalore; Editing by Supriya Kurane)