U.S. regulators said on Thursday that residential mortgage servicers dealing with first and subordinated liens on the same property must focus on getting the best overall deal for the loan's owners.

Servicers have an obligation to act in the best interests of the owners/investors of serviced residential mortgage loans ... Any decisions that are not anticipated to produce a greater recovery to investors given the alternatives may constitute a breach of that duty, the Federal Financial Institutions Examination Council (FFIEC) said in a statement.

The FFIEC consists of the Federal Reserve, the Federal Deposit Insurance Corporation, the Office of the Comptroller of the Currency, the National Credit Union Administration, the Office of Thrift Supervision and the State Liaison Committee, which represents financial supervisors at the state level.

Millions of U.S. homes are in foreclosure or heading in that direction after the housing market collapsed, sparking the worst recession since the 1930s Great Depression.

Mortgage lenders are working with loan servicers to make changes to monthly payments and, in some cases accept a cut in the principle of the loan amount. The effort is aimed at making the mortgages more affordable and to keep as many home owners as possible from slipping into foreclosure.

This task is complicated when the home buyer has more than one loan secured on the property.

The regulators said that the loan servicer must not trade off interests between the first and second lien, but rather do whatever gets the best overall return for investors, regardless of how it impacts the different tranches of debt.

Regardless of any potential effect on the subordinate lien obligations, servicers should modify the first lien mortgage when doing so would produce a greater anticipated recovery to the first lien owners/investors than not modifying the loan, they said.

Similarly, regardless of any potential effect on the first lien mortgage, servicers should modify the subordinate lien loan when doing so would produce a greater anticipated recovery to the subordinate lien owners/investors than not modifying the loan, the regulators added.

(Reporting by Alister Bull)