Lance Armstrong has reached a $5m settlement with the federal government in a whistleblower lawsuit that could have sought $100m in damages from the cyclist who was stripped of his record seven Tour de France victories after admitting he used performance-enhancing drugs throughout much of his career.

The deal announced Thursday came as the two sides prepared for a trial that was scheduled to start 7 May in Washington. Armstrong’s former US Postal Service team-mate Floyd Landis filed the original lawsuit in 2010 and is eligible for up to 25 percent of the settlement.

Seeking millions spent sponsoring Armstrong’s powerhouse teams, the government joined the lawsuit against Armstrong in 2013 after his televised confession to using steroids and other performance-enhancing drugs and methods.

Armstrong had already retired, but the confession shattered the legacy of one of the most popular sports figures in the world.

In a statement to the Associated Press, Armstrong said he’s happy to have “made peace with the Postal Service”.

“While I believe that their lawsuit against me was meritless and unfair, and while I am spending a lot of money to resolve it, I have since 2013 tried to take full responsibility for my mistakes and inappropriate conduct, and make amends wherever possible,” he said. “I rode my heart out for the Postal cycling team, and was always especially proud to wear the red, white and blue eagle on my chest when competing in the Tour de France. Those memories are very real and mean a lot to me.”

The settlement clears the 46-year-old Armstrong of the most damaging legal issues still facing the cyclist since his downfall. He had already taken huge hits financially, losing all his major sponsors and being forced to pay more than $20m in damages and settlements in a series of lawsuits. The government’s lawsuit would have been the biggest by far.

Armstrong is still believed to be worth millions based on a vast investment portfolio and homes in Austin, Texas, and Aspen, Colorado. He also owns a pair of bicycle shops in Austin and WeDu, an endurance events company. He also hosts a regular podcast in which he interviews other sports figures and celebrities and has provided running commentary on the Tour de France.

Armstrong had built a world-wide following during his career winning races and fighting cancer.

His personal story of recovering from testicular cancer that had spread to his brain, while forcefully denying persistent rumors of doping, had built his Lance Armstrong Foundation cancer charity into a $500m global brand and

turned him into a celebrity. The foundation, which removed him from its board and renamed itself Livestrong, has seen donations and revenue plummet since Armstrong’s confession.

Armstrong’s team was already under the Postal Service sponsorship when he won his first Tour de France in 1999. The media frenzy that followed pushed the agency to sign the team for another five years. Armstrong and his teams dominated cycling’s marquee event, winning every year from 1999-2005.

Armstrong’s cheating was finally uncovered in 2012 when the US Anti-Doping Agency (Usada), armed with sworn testimony from Landis and other former teammates, moved to strip Armstrong of his titles.

Landis, himself a former doping cheat who was stripped of his 2006 Tour de France title, sued Armstrong under the federal False Claims Act, alleging Armstrong and his team committed fraud against the government when they cheated while riding under the Postal Service banner. According to court records, the contract paid the team, which was operated by Tailwind Sports Corp., about $32m from 2000 to 2004. Armstrong got nearly $13.5m.

Under the lawsuit, the government could have pursued “treble” damages, which could have reached the $100m range. As the person who filed the original lawsuit, Landis is eligible for up to 25% of the settlement, which will include an additional $1.65m paid to Landis’ attorneys.

Armstrong had claimed he didn’t owe the Postal Service anything because the agency made far more off the sponsorship than it paid; Armstrong’s lawyers introduced internal studies for the agency that calculated benefits in media exposure topping $100m. The government countered that Armstrong had been “unjustly enriched” through the sponsorship and that the negative fallout from the doping scandal tainted the agency’s reputation.

Armstrong had been the target of a federal criminal grand jury, but that case was closed without charges in February 2012. Armstrong had previously tried to settle the Landis whistleblower lawsuit, but those talks broke down before the government announced its intention to join the case.

“I am glad to resolve this case and move forward with my life,” Armstrong said. “I’m looking forward to devoting myself to the many great things in my life my five kids, my wife, my podcast, several exciting writing and film projects, my work as a cancer survivor, and my passion for sports and competition. There is a lot to look forward to.”

