Liberty Mutual Group, a diversified insurer, agreed to buy Safeco Corp. for $6.2 billion on Wednesday, which would make Liberty Mutual the fifth largest U.S. insurer.

The terms of the deal call for Boston-based Liberty Mutual to buy all the company's stock for $68.25 per share in cash. The boards of both companies have agreed to the deal, but it is still subject to approval by Seattle-based Safeco shareholders and regulators.

Safeco shareholders are being paid almost a 51 percent premium for their shares. Shares rose 45.8 percent, or $20.71 to close at $65.94.

Liberty Mutual is currently the sixth largest property and casualty insurer based on last year's direct written premium of $20. 2 billion while Safeco's premium was $5.9 billion.

Liberty Mutualsaid in a statement that Safeco will become a part of its Agency Markets business unit, which focuses on independent agency distribution.

Safeco specializes in insurance for individuals and for small and mid-sized businesses, selling its products through a national network of agents and brokers.