Royal Bank of Scotland Group Plc moved closer to clearing a backlog of charges for misconduct that have slowed its return to profitability, agreeing to pay as much as 800 million pounds ($1 billion) to settle investor lawsuits over its 2008 emergency rights offering.

The bank has reached agreement with three of the five shareholder groups representing 77 percent of the claims by value, the Edinburgh-based lender said in a statement on Monday. RBS is still in discussions with the other two groups, it said. The 800 million pounds, which is covered by existing provisions, would be split among the five groups.

Chief Executive Officer Ross McEwan has been plagued by misconduct issues from payment protection insurance to the sale of mortgage-backed securities ahead of the financial crisis, which pushed the state-owned lender to fail Bank of England stress tests last week. He’s still awaiting a deal with U.S. authorities probing subprime bond sales and is struggling to sell the bank’s Williams & Glyn business at the behest of European antitrust regulators.

“This settlement helps to clear up some of the uncertainties regarding these legacy costs,” Sandy Chen, an analyst at Cenkos Securities Plc in London, with a hold rating on shares, wrote in a note to clients. Offering 800 million pounds to settle the rights offer litigation “would finally put to bed that particular ghost of Christmas past.”

The stock gained 1.9 percent to 197 pence at 10:02 a.m. in London trading, paring its loss to 35 percent this year as the worst-performing major British bank.

Last-Ditch

RBS had already set aside enough funds for the rights offer settlement, hurting earnings in the past two quarters. Shareholders who subscribed for about 4 billion pounds of stock have said the bank made untrue and misleading statements in its 2008 emergency share sale, undertaken by former chief Fred Goodwin in a last-ditch attempt to rescue the lender before its taxpayer bailout.

“We have been very clear that we wanted to deal with as many of our legacy litigation issues as possible during 2015 and 2016,” McEwan said in the statement. “We are pleased to have reached this agreement and hope that it will be accepted by the remaining claimant groups, so that this long course of complex and costly litigation can now be concluded.”

RBS said in its statement Monday that any claims for which an agreement cannot be reached will be defended in court. Claimants represented by Leon Kaye Solicitors and Signature Litigation, which include 27,000 mom and pop investors, have yet to reach a deal. The trial for those claims is due to start in March and Goodwin is named among defendants who could be called to give evidence.

Painful Costs

RBS’s conduct and litigation costs topped 1.74 billion pounds in the first nine months this year, up 20 percent from the same period of 2015, driven in part by provisions for the rights offer lawsuit.

Separately, the bank’s chief conduct and regulatory affairs officer, Jon Pain, will retire next year after three years with RBS, according to an internal memo to staff obtained by Bloomberg News. The bank will integrate his team with several other departments, including its risk division led by chief risk officer David Stephen.

A former managing director of supervision at the U.K.’s Financial Conduct Authority during the financial crisis who joined the bank in 2013, Pain helped RBS reach settlements with British and U.S. authorities over the manipulation of Libor and currency markets that cost the bank more than 1 billion pounds.