Tesco (TSCDY)  said Tuesday that it reached an agreement with the U.K.'s Serious Fraud Office and Financial Conduct Authority over a historical accounting scandal.

The Deferred Prosecution Agreement requires Britain's biggest retailer to pay a financial penalty of £129 million ($162 million) in return for not being prosecuted. Tesco will also pay around £85 million to shareholders for overstating its profits between February 2014 and September 2014.

Under an agreement with the FCA for a market abuse charge related to the company's trading statement on Aug. 29, 2014 due to the same scandal, Tesco will set up a compensation programme to certain purchasers of shares and listed bonds between Aug. 19, 2014 and Sept. 19, 2014.

Each net purchaser of shares will be entitled to compensation of 24.5 pence per share purchased plus interest of 1.25% a year for institutional investors and 4% of interest a year for retail investors. KPMG will administer the program, with oversight from the FCA.

Once approved by the Court, the deal will end Tesco's investigation by the SFO and its dealings with the FCA.

"Over the last two and a half years, we have fully cooperated with this investigation into historic accounting practices, while at the same time fundamentally transforming our business," Tesco CEO Dave Lewis said in a statement. "We sincerely regret the issues which occurred in 2014 and we are committed to doing everything we can to continue to restore trust in our business and brand." 

In September 2014, Tesco said it is had misstated profits for the first half of the year to the sum £326 million. The retailer later restated its 2015 financial statements resulting in a £6.3 billion loss.

The accounting scandal led to an extensive change to leadership, structures, financial control, partnerships with suppliers and the way the business buys and sells, Tesco said on Tuesday.

Tesco shares closes at 189.95 pence on Friday and have lost 43.81% of their value over the past five years.