Uber has won back its London license after a two-day court battle .

But Uber isn't out of the woods: The license lasts only 15 months, and Uber has to meet conditions from London's regulator.

Despite making a decision favorable to Uber, Chief Magistrate Emma Arbuthnot was critical of the company.

In a hearing at Westminster Magistrates' Court she said Uber thought it was "above the law."

Uber said it deserved to lose its license last year but argued it had made lots of changes in the past nine months.

Uber has won back its London license after a two-day court battle with the capital's regulator.

The win is a boost for the company's new CEO, Dara Khosrowshahi. Much of Uber's case rested on convincing the court that it was past the bad-boy days of its former CEO Travis Kalanick and ready to reform.

Chief Magistrate Emma Arbuthnot granted Uber a 15-month license to operate on the condition that the firm undergoes an independently verified audit every six months.

Transport for London, the capital's regulator, will then decide whether to renew Uber's license again.

Uber has also agreed to several other conditions from TfL. These include reporting all serious safety complaints, training existing and new Uber drivers on car-sharing safety, and informing TfL of any major data breaches.

TfL had complained last year about the company's approach to reporting serious driver offenses. Its record on driver medical and safety checks, and the use of its secret "Greyball" software to dodge transport officials, also contributed to the decision.

"We are pleased with today's decision," an Uber spokesman said. "We will continue to work with TfL to address their concerns and earn their trust, while providing the best possible service for our customers."

Mayor Sadiq Khan of London said the court had "vindicated" TfL's original decision not to renew Uber's license in September. "Uber has been put on probation — their 15-month license has a clear set of conditions that TfL will thoroughly monitor and enforce," he said in a statement.

Judge: Uber 'thought they were above the law'

Despite Uber's victory, both TfL and Arbuthnot landed some solid punches.

At one point during the proceedings on Tuesday, Arbuthnot said she had the impression that Uber "thought they were above the law."

And TfL's interim head of licensing, Helen Chapman, described a tough relationship with Uber. "We've had five years of a very difficult relationship where Uber has felt that they haven't required regulation and being regulated in the same way as everyone else we regulate," she told the court on Tuesday.

She added that there were some serious cases in which Uber had not taken complaints about drivers seriously enough, though she didn't go into detail.

"Frankly some of the cases I've seen are quite appalling when they haven't taken any action," she said, adding that some "that have been raised are very disturbing."

Chapman added that while Uber had now reviewed complaints about drivers, "public safety has been compromised" in the meantime.

Uber said it fundamentally changed as a business since September

Uber maintained an apologetic tone throughout the two days, saying it probably deserved to lose its license because of the mistakes and corporate culture created under the previous CEO Kalanick.

Executives including the company's UK board chairwoman, Laurel Powers-Freeling; UK head of cities, Fred Jones; and UK and Ireland chief, Tom Elvidge, took the stand.

Those executives acknowledged that Uber had not been fully transparent with regulators and that the information it had provided them in the past had been inadequate and even misleading. But its lawyer Thomas de la Mare argued that Uber had made "wholesale change in the way that we conduct our business."

The firm pointed to its agreement with the Metropolitan Police to report serious crime, agreements with Uber's US parent firm to keep regulators in the loop about major product changes or issues, and the appointment of nonexecutive directors to its UK board.