Late last month, Uber sued the city of Seattle, challenging the city’s authority to implement a landmark law allowing drivers in the gig economy to unionize. It was an opening shot in what is likely to be a long and costly legal battle.

Uber’s legal challenge comes at an awkward time for the ride-hailing juggernaut. The company recently named 2017 “the year of the driver” and has said it will devote energy and resources to improving its relationship with the hundreds of thousands of people who drive on its platform. But the company’s bungled response to a taxi strike during the recent JFK protests led to a grassroots #DeleteUber campaign that saw 200,000 riders canceling their accounts. This latest situation in Seattle may further complicate Uber’s attempts to reverse the negative effects of that campaign.

“Year of the driver” hits a snag

The law in Seattle, passed by the city council in a 9–0 vote, was a first of its kind. It allows drivers for ride-hailing apps like Uber and Lyft to unionize and collectively bargain for better working conditions, earnings, and other benefits. The bill was a victory for the App-Based Drivers Association, which had lobbied with the local Teamsters union on behalf of freelance contractors.

After its passage in December 2015, Uber and Lyft declined to challenge it outright, instead supporting a lawsuit brought by the pro-business, anti-union US Chamber of Commerce. But then in August, a judge tossed the chamber’s lawsuit, calling it premature until the city moved forward with implementation.

That implementation began in December, when Seattle’s department of Finance and Administrative Services published rules online that cover issues like which drivers get to unionize, working conditions subject to bargaining, and how an organization gets certified to represent drivers exclusively.

“arbitrary and capricious”

Shortly thereafter, Uber filed a lawsuit challenging the city’s rulemaking authority, calling it “arbitrary and capricious” and inconsistent with “fundamental labor laws,” according to court documents. “The City must follow a lawful rulemaking process and adopt rules which properly consider the facts and circumstances of drivers and the industry, and labor law precedent,” Uber argues in the suit.

The city of Seattle has already filed its response to Uber, and is confident that the court will rule in favor of the city’s authority in implementing this law. “What [the city] did was absolutely appropriate under the circumstances,” city attorney Michael Ryan told The Verge.

A hearing on the lawsuit was originally scheduled for February 10th, but then moved to March 17th after the Teamsters signaled their intent to support the city against Uber’s challenge. According to a spokesperson, Lyft is not participating in the lawsuit, but is watching its outcome very closely.

A possible twist in all this: last year, The Verge uncovered evidence of Uber using a CIA-linked firm to investigate union politics in Seattle. Uber confirmed the project and characterized the effort as research into the city's political landscape, emphasizing that it was not targeted at any individuals or drivers. Whether the Teamsters, or any labor groups involved in the lawsuit, see it the same way remains to be seen.