American gun manufacturer Remington has announced it will replace triggers in millions of its popular rifles after years of claims that the guns can fire without a user pulling the trigger and allegations that malfunctioning caused several deaths. In a nationwide settlement filed Friday in a federal court in Missouri, the company said it will replace triggers in nearly 8 million rifles.

The manufacturer had agreed in July to settle in the class-action suit initially filed in January 2013 and involving guns manufactured from 1948 to April 2014, but a federal judge had to approve the settlement.

Remington had already offered to replace customers’ rifles that had X-Mark Pro (or XMP) triggers because they could fire without warning. The company has been the focus of dozens of lawsuits and class actions alleging that the triggers on Model 700 and Model Seven rifles, especially those manufactured from May 2006 to April 2014, are defective.

“Defendants have known since 1979 that at least 1 percent of all Model 700 rifles at that time would ‘trick,’ allowing them to fire unexpectedly without a trigger pull,” gun owner Ian Pollard, who filed the class-action suit, said in the suit. “This percentage is vastly understated and all Model 700 rifles are subject to unexpected firing without a trigger pull.”

Media investigations, including one in 2010 by CNBC, have reported allegations stretching back decades that Remington covered up a design defect, but the company has denied the claim.

“A Remington investigation has determined that some XMP triggers might have excess bonding agent used in the assembly process,” the company tells customers in its safety center online. “While Remington has the utmost confidence in the design of the XMP trigger, it is undertaking this recall in the interest of consumer safety to remove any potential excess bonding agent applied in the assembly process.”