SAN FRANCISCO (Reuters) - A U.S. judge gave final approval on Thursday to a settlement agreement in a class-action lawsuit against Lyft Inc, ending a legal case that challenged the independent contractor status of the ride-hailing service’s drivers.

A smartphone app for Lyft drivers is seen during a photo opportunity in San Francisco, California February 3, 2016. REUTERS/Stephen Lam

U.S. District Judge Vince Chhabria in San Francisco gave his final approval to the $27 million settlement, after granting preliminary approval in June, according to court filings.

The judge had previously rejected a $12.25 million settlement offer because it “short-changed” drivers.

Lyft drivers in California had sued the company, arguing they should be classified as employees and therefore be entitled to reimbursement for expenses, including gasoline and vehicle maintenance. Drivers pay those costs themselves.

The settlement agreement keeps drivers as independent contractors.

In his order, Chhabria cautioned, “The agreement is not perfect. And the status of Lyft drivers under California law remains uncertain going forward.”

Uber Technologies Inc [UBER.UL] faces a similar class-action lawsuit from drivers in California and Massachusetts. A settlement offer in that case valued at up to $100 million was rejected last year by a judge who deemed it inadequate for drivers.

Lyft has more than 700,000 drivers nationally and Uber has more than 1.5 million globally. The profits and valuations of these companies would be severely affected if they had to reclassify drivers as employees.

Attorney Shannon Liss-Riordan, who represents the Lyft drivers, said on Thursday she was “very pleased to be at the end of this process.” The lawsuit was filed in 2013.

A Lyft spokeswoman said the settlement agreement “will preserve the flexibility of drivers to choose when, where and for how long they drive with Lyft.”

The company has said that driver surveys show that more than 80 percent of Lyft drivers prefer being independent contractors because of the flexibility that status allows.

The settlement provides thousands of dollars to Lyft drivers who logged the most miles, although infrequent drivers will see a nominal amount of cash. As part of the agreement, drivers also get benefits such as more protections from getting kicked off the app.

“The question of whether the drivers are appropriately classified as employees or independent contractors will just have to wait for another day,” Liss-Riordan said.