The closely watched case could affect consumers.

NEW YORK (AP) – MasterCard International struck a last-ditch settlement with thousands of retailers Monday just before their multibillion-dollar lawsuit over debit card practices was set to go to trial.

The settlement left Visa USA to battle it out in court with the retailers, including big names Wal-Mart, Sears and Circuit City.

The retailers say Visa and MasterCard have trapped them into paying high fees by demanding that stores accept their debit cards along with their credit cards. They also say the card companies are stifling competition.

Visa and MasterCard say their honor-all-cards policy actually increases customer choice. Both sides say they are fighting for the best interest of consumers.

U.S. District Judge John Gleeson did not give details of the MasterCard settlement and he barred both sides from discussing it publicly. “I don’t want this jury pool tainted by that,” he said.

While details were being finalized late Monday, a source close to the settlement said it would involve both a payment from MasterCard and a change in some of MasterCard’s business practices.

The framework of the settlement was reached after a weekend of negotiations that at times “actively involved” the judge himself, the source said on condition of anonymity.

Meanwhile, lawyers for Visa and the retailers settled on a jury and Gleeson scheduled opening arguments for Wednesday.

Lawyers for the merchants have declined to place a dollar figure on damages they will seek if they prevail, but some independent analysts said Visa and MasterCard together could have been liable for as much as $45 billion.

The 1996 suit said Visa and MasterCard unfairly require merchants to accept their debit cards, which require a customer’s signature to verify a transaction. The plaintiffs say the process ultimately costs consumers more money.

Many retailers would rather use less expensive, independent networks that clear debit-card transactions using a personal identification number, or PIN.

The matter is going to trial at a time when debit cards – which deduct cash from an existing bank account rather than building up debt in a credit account – enjoy high popularity.

Visa wouldn’t comment on the settlement. A spokesman referred a reporter to a statement issued before the settlement by Visa USA vice president Daniel Tarman: “Visa will show that the debit market is fiercely competitive, and that consumers have greatly benefited from the current payment system.”

And while no one who spoke privately about the case Monday would rule out a settlement between Visa and the retailers, Tarman’s statement said Visa remained focused on “demonstrating at trial” that it had acted in consumers’ interest.