German insurer Allianz on Thursday said it had agreed to sell its Fireman's Fund personal insurance business to insurer ACE for $365 million, freeing Allianz to focus on building its U.S. property and casualty operations.

Allianz, Europe's largest insurer had said in September it was looking at options for the personal lines part of the business, which it said was profitable. At that time it unveiled plans to integrate Fireman's Fund's commercial property and casualty (P&C) business into its AGCS unit.

The deal clears up one of two problem areas for Allianz in the United States before Oliver Baete takes over from Michael Diekmann as group chief executive next May.

Allianz had struggled for years to bring underwriting losses under control at Fireman's Fund.

It is still working to dispel doubts about investment management unit Pimco, which has seen billions in investor outflows and the sudden departure of top executives, including the unit's founder, "Bond King" Bill Gross, this year.

The Fireman's Fund personal lines business had nearly $900 million in gross written premiums in 2013 and ranked third among insurers serving the U.S. high net worth consumer market, Allianz and ACE said.

"The acquisition includes the renewal rights for new and existing business, reinsurance of all existing reserves, and access to an extensive network of approximately 1,100 agents and brokers," the companies said.

The transaction was expected to add to ACE's earnings immediately upon completion, planned for the second quarter of 2015, ACE Chairman and Chief Executive Evan G. Greenberg said.

"High net worth personal lines remains a strategic growth area for ACE," Greenberg added.

Allianz said proceeds from the sale would help finance the restructuring of its U.S. P&C operations, where it is consolidating legacy problem areas like asbestos, environment and worker's compensation into a separate unit focused on winding down those businesses.