Lowe’s will pay $6.5 million to settle a class-action suit in California that alleged the nation’s No. 2 home improvement retailer treated independent contractors like company employees without giving them any of the benefits.

The $6.5 million—roughly 20% of what Lowe’s might have paid had the case gone to trial—will be shared with anyone who performed at least one installation job for Lowe’s in California from June 2008 through last week, when the proposed settlement was entered into the U.S. District Court for the Northern District of California. Approximately 4,029 individual installers and 949 installation companies will be eligible to get the payments, and the maximum payment anyone can get in the settlement is roughly $1,613, a court document stated.

The agreement ends a nearly two-year-old legal fight that began when Ronald Shephard and Henry Romines filed suit in state court arguing that Lowe’s violated California labor law in using them to install garage doors from 1995 to 2009. The two argued that they shouldn’t be regarded as independent contractors because they said Lowe’s controlled all aspects of all their work. They said that control included where and when Shephard and Romines did jobs, how they were to dress (in shirts and hats with the Lowe’s logo), how they should describe themselves (as Lowe’s employees), how they got compensated (the customers paid Lowe’s, which in turn wrote a check), and whether they could do extra work for the customer on their own (they couldn’t). The plaintiffs also noted that their official status as independent contractors meant they weren’t entitled to overtime pay; vacation, holiday, or sick pay; and health care and other insurances that were part of Lowe’s benefits.

Lowe’s got the case transferred from state into federal court. Romines voluntarily dismissed his claims in February 2013, but four months later Shephard sought to get the case converted into a class-action lawsuit. Also last year, a Victorville, Calif.-based installation firm named Merrill’s Garage Doors Inc. (MGDI), where Shephard worked, was added as a plaintiff. It was MGDI that contracted with Lowe’s and was paid by the retailer, who in turn paid Shephard.

Last Aug. 19, the federal court agreed to treat the case as a class-action lawsuit. A series of technical legal maneuvers ensued, but in January the two sides also went to a mediator. They emerged with the foundations of the agreement presented to the federal court on Friday, May 23.

The plaintiffs’ motion for a settlement continued to stress their belief they could prove that Lowe’s misclassified Shephard and harmed MGDI. But they also recognized that Lowe’s would fight back, saying Lowe's would assert that “each installation company operated their own separate business, hired their own employees, paid their employee’s wages and benefits and made all decisions relating to employment matters and issues … so they could not possible be deemed employees of Lowe’s.”

The contract between MGDI and Lowe’s “indicates that all individuals working for MGDI on Lowe’s jobs would be treated as independent contractors, including plaintiff Shephard,” plaintiffs said in their amended complaint. “Lowe’s provided MGDI with Form 1099s for all income received from Lowe’s. Thus, MGDI paid all of the taxes associated with employing Shephard when Lowe’s should have paid these taxes. Furthermore, Lowe’s avoided the costs of insuring Shephard and other installers by requiring MGDI and other installation companies to bear those costs.”