WILMINGTON, Del (Reuters) - Lenders and hundreds of investors agreed on Monday to pay $231 million to end their decade-long legal fight over a clerical error in a $1.5 billion loan to General Motors that was administered by JPMorgan Chase & Co JPM.N, according to court documents.

FILE PHOTO: A logo of General Motors is pictured at its plant in Silao, in Guanajuato state, Mexico, November 9, 2017. Picture taken November 9, 2017. REUTERS/Edgard Garrido

The settlement payment will benefit the unsecured creditors of General Motors’ 2009 bankruptcy, as well as the U.S. and Canadian governments, which helped finance GM’s Chapter 11 case.

The unsecured creditors, who collected pennies on the dollar from GM’s bankruptcy, have been trying for years to recoup some of the $1.5 billion that was paid to GM’s secured lenders.

The $1.5 billion loan was syndicated to hundreds of investors who were defendants in the lawsuit. The individual settlement contributions by JPMorgan, a law firm that handled the paperwork and the investors in the loan were not disclosed in court documents.

JPMorgan declined to comment.

The dispute stemmed from the unintentional release of a lien on GM equipment due to a paperwork error.

At the end of 2008, the automaker was preparing to pay off a $300 million financing. The law firm handling the paperwork accidentally included a lien that secured the $1.5 billion loan in the list of security interests it terminated after the $300 million was repaid.

Releasing the lien rendered part of the loan unsecured, allowing a trustee working for unsecured creditors of GM to try to claw the money back.

The mistake did not invalidate all liens securing the $1.5 billion loan, and the parties have spent years disputing whether GM assets such as robots and conveyor belts secured loan.

GM’s predecessor filed for bankruptcy in 2009, beset by a deep U.S. recession, an enormous debtload, high labor costs and outdated car models.