Uber has won back its licence to operate in London after a judge overturned a ban.
Transport for London refused to renew the licence when it expired last September, saying the US ride-hailing firm was not a "fit and proper" operator.
Following a court hearing, Uber has been granted a licence but it has been put on probation for 15 months.
Uber had been seeking a five-year licence when it was refused last year.
Following a two-day hearing at Westminister Magistrates' Court, Chief Magistrate Emma Arbuthnot said Uber was now considered "fit and proper".
She ordered the company to pay TfL's legal costs of £425,000.
London mayor Sadiq Khan said: "After years of operating poorly in London, Uber has now accepted that TfL's action in refusing to renew their licence was totally justified. Today our stance has been vindicated by the court.
"Uber has been put on probation - their 15-month licence has a clear set of conditions that TfL will thoroughly monitor and enforce."
Tom Elvidge, Uber's UK general manager, said he was pleased with today's decision: "We will continue to work with TfL to address their concerns and earn their trust while providing the best possible service for our customers."
One of the areas of concern that TfL highlighted last year was about how Uber reported the crime.
The company said that it had made "wholesale" changes to the business since last September.
This includes reporting crimes directly to the police instead of logging criminal complaints with TfL, which caused delays.
During this week's hearing, Helen Chapman, the licensing, regulation and charging director at TfL, said that Uber's behaviour over reporting allegations to police was "very disturbing".
She said: "I think we have had five years of a very difficult relationship where Uber has felt they haven't required regulation and being operated in the same way as everybody else we regulate."
Ms Chapman said that the changes implemented by Uber "could if applied correctly, enhance public safety".
In its decision not to renew Uber's operating licence last year, TfL said the way the firm was run had potential public safety and security implications when it decided not to renew its licence to operate in London last year - a decision backed by Mr Khan.
In particular, it highlighted Uber's approach to reporting serious criminal offences, how medical certificates are obtained and background checks on drivers.
Uber rejected TfL's assertions that it endangered the public and said it would appeal. It has been able to continue to operate in the capital during the appeals process.
The company also said it was "determined to make things right".
Among the changes implemented by Uber, drivers can now only use the app in the region in which they hold a private hire licence and their working hours are more tightly regulated.
A licensed driver on the app has to now take an uninterrupted six-hour break after 10 hours of taking passengers or travelling to pick them up.
The firm also made changes to its app in London to "make it clearer" to passengers that its drivers are licensed by TfL and that it accepts ride requests before allocating drivers.
It also dropped an appeal against a move that would make all its drivers in the city take English language tests.
Chris Bryce, chief executive at the Association of Independent Professionals and the Self-Employed, said: "The safety of passengers is of paramount importance and should always be the priority.
"Today's decision will be welcome news for the 45,000 hardworking, honest and dedicated Uber partner drivers, who value the flexibility that this way of working provides."
Culture Secretary Matt Hancock tweeted: "Glad to see sense has prevailed on Uber and millions of Londoners can continue to use their great service."