HCP Inc. on Tuesday said it reached a $50 million deal to terminate the contracts on 27 of its senior housing communities managed by Sunrise Senior Living Inc.

HCP said it will enter into new arrangements for the 27 communities that will reflect improved operating margins. The changes will take place through the end of the year.

The company previously shifted 30 communities to new operators from Sunrise, including four that it acquired in June. McLean, Va.-based Sunrise still has contracts at 48 HCP-owned communities.

HCP will pay Sunrise $50 million as part of the deal. That will include an immediate payment of $40 million, with the remaining balance paid over the next 12 months. In addition, Sunrise has agreed to limit certain fees and charges associated with its remaining contracts.

The deal will end all litigation between the two companies.

In its quarterly report filed Aug. 3, HCP detailed a 2009 complaint against Sunrise based on management of 64 facilities, charging that it failed to maintain licenses necessary for operation, disregarded facility budgets, mishandled finances, obstructed efforts to audit operations and other matters. Sunrise filed counterclaims maintaining HCP and its subsidiaries breached contractual duties.

A second matter regarding certain properties that had been removed from that case was filed in July 2009, according to Sunrise's quarterly report. Sunrise won an initial ruling in April but HCP appealed and Sunrise had cross-appealed.

In aftermarket electronic trading, HCP shares slipped a penny to $35.21, after closing down 13 cents at $35.22. Sunrise Senior Living shares added 34 cents, or 15.4 percent, to $2.55 after hours, following a close down 4 cents at $2.21.