VANCOUVER -- The City of Surrey spent more than $41,000 on external legal fees to fight a court battle against Uber drivers.

Ultimately, the city lost its bid to keep Uber out of Surrey: on Feb. 7, a judge ordered Surrey to stop issuing $500 fines against Uber drivers. CTV News obtained the $41,809 figure through a freedom of information request.

Surrey started issuing the fines to drivers after provincial rules that allow ride-hailing came into effect earlier this year. With the Mayor of Surrey, Doug McCallum, repeatedly promising that Uber was not welcome in Surrey, drivers soon found themselves on the wrong side of city bylaw officers.

Surrey ticketed Uber drivers on the grounds that they were operating without a business licence from the city, and Uber said that dozens of drivers received the tickets.

But in her decision, Madame Justice Veronica Jackson found that since the provincial Passenger Transportation Board had approved ride-hailing and there is no Surrey business licence to apply for, the company's drivers cannot be fined for working in the city.

The $41,809 that Surrey spent isn't the entire amount: that figure only includes external legal services.

A freedom of information clerk with the City of Surrey told CTV News that "lawyers and staff in the City of Surrey's Legal Services Division do not record the time they spend on individual legal matters."

Following the court decision, McCallum said it was "time to move on." He pledged to work with TransLink on a mayors' council motion to work on a regional business licence that would "ensure a level playing field between ride-hailing and taxis."

With files from CTV News Vancouver's Penny Daflos.