Winchester-based manufacturer Trex said on Wednesday that a court has approved a settlement in a nationwide class-action lawsuit that alleged that some of the company’s composite decking products were defective.

According to the terms of the settlement, Trex is to provide qualified claimants with a cash payment or the chance to receive other relief, such as a rebate certificate for its more recent product lines.

“We are pleased to have a final resolution of this matter, with terms we feel are fair to both Trex and our consumers,” chief executive Ronald W. Kaplan said in a statement.

The suit alleged that certain Trex decking products were prone to mold growth or experienced color fading or color variation. To qualify for the relief, claimants must have purchased first-generation Trex composite products between August 1, 2004 and August 27, 2013 and must have experienced mold or color problems with the decking.

The settlement could cost Trex up to $8.3 million, plus $1.5 million in attorney fees for the plaintiffs.

In a filing with the Securities and Exchange Commission, Trex said it “denied any liability in the settlement and agreed to the settlement in order to avoid additional expensive, time consuming litigation.”