Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Uber will pay $20 million to its drivers in California and Massachusetts to settle a class-action lawsuit that raised the question of what responsibility the company has to its workers.

Lawyers for Uber said in a court filing Tuesday that they had agreed to a settlement with thousands of drivers. U.S. District Judge Edward Chen is set to hear the two sides’ motion on the preliminary settlement on March 21 in his San Francisco courtroom. Ultimately he will decide whether the settlement can go forward.

While the deal won’t end the longstanding and thorny question of whether Uber’s drivers are employees or contractors, the settlement likely will resolve the lawsuit that has forcefully pushed this question into court.

Numerous gig-economy companies including Uber, Lyft, DoorDash and Instacart save millions of dollars annually by not classifying drivers and delivery people — the backbone of their workforce — as employees.

The companies do not pay health insurance, retirement, unemployment or other benefits that many traditional employees expect. Uber uses the phrase “driver-partners” to refer to most of its workers.

The lawsuit, O’Connor v. Uber, has been pending in federal court since it was brought in August 2013 and argued that thousands of drivers had been misclassified as contractors and were improperly denied business expense reimbursement.

The new settlement covers approximately 11,000 drivers in California and 2,600 in Massachusetts who will collectively receive the $20 million.

According to a Monday court filing, the “average net settlement share” will be $2,206 per driver after attorneys’ fees, more than five times what had been proposed three years ago.

“Under this settlement, we estimate these drivers will receive approximately 37 cents per mile for the miles they have driven for Uber (depending on the exact claim rate),” Shannon Liss-Riordan, the plaintiffs’ lead attorney, said in an email to NBC News on Tuesday.

“This is a substantial recovery, given that the IRS reimbursement rate has varied between 50 and 58 cents per mile.”

Byers Market Newsletter Get breaking news and insider analysis on the rapidly changing world of media and technology right to your inbox. This site is protected by recaptcha

Drivers not covered by this deal who want to recover money will have to bring a private claim via arbitration, a private quasi-legal process that is criticized by labor groups for favoring corporations over individuals.

Noah Edwardsen, an Uber spokesperson, declined to respond to NBC News’ specific questions about the settlement.

“Uber has changed a lot since 2013,” the company said in a statement. “We have made the driver experience even better through improvements like in-app tipping, a redesigned driver app, an innovative injury protection insurance option, and new rewards programs like Uber Pro. We’re pleased to reach a settlement on this matter and we’ll continue working hard to improve the quality, security and dignity of independent work.”

The two sides nearly reached a settlement in 2016 that covered far more drivers. The case was eventually appealed to the 9th U.S. Circuit Court of Appeals in 2017, where it was finally sent back down to the lower district court.

Liss-Riordan said that the settlement was not the end of the legal battle over gig economy workers.

“This is not the end of the issue of driver classification,” Liss-Riordan said. “We are continuing to pursue many cases against gig-economy companies (and others) that are misclassifying their workers as independent contractors, in order to save on labor costs and shift the risks and expenses of operating a business to their low-wage workers.”

“Mostly a win for Uber”

Legal experts say that Uber’s impending initial public offering likely brought pressure to settle the case.

Uber and its largest rival, Lyft, are both set to go public later this year. In a filing with the Securities and Exchange Commission released earlier this month, Lyft stated that there may be more “regulatory scrutiny” on tech companies that have so many “independent contractors,” and that new laws may be “adverse to our business.”

According to Veena Dubal, a labor law professor at the University of California, Hastings in San Francisco, Uber is “incentivized to get out from under potentially impactful legal decisions.”

But, she observed, Uber has been successful in staving off what could have been more financial damage.

“Since the near-settlement three years ago, the class of drivers has been seriously undermined by higher courts,” Dubal said in an email.

The class has gone from 400,000 drivers to almost 14,000.

“The value of the settlement itself is really hard to assess," Dubal said. "Of course, if the drivers won at trial, especially on the reimbursement expenses, they would have the potential to make much more.”

Michael LeRoy, a labor law professor at the University of Illinois, said that this was a relatively easy way for the company to end a lengthy lawsuit that could have dragged on for years. Plus, in the end, $20 million is a very small amount for a company reported to be worth about $120 billion.

“I rate this as mostly a win for Uber,” LeRoy said in an email. “The monetary settlement is a small fraction of their potential liability, and their business model of utilizing drivers as independent contractors remains intact.”