CAIRO (Reuters) - Egypt’s parliament passed a law on Monday regulating ride-sharing apps Uber and Careem, potentially ending a lawsuit that could shut them down in one of their biggest markets but imposing new fees and data sharing requirements.

FILE PHOTO: Employees work inside Uber's Centre of Excellence office in Cairo, Egypt October 10, 2017. REUTERS/Amr Abdallah Dalsh/File Photo

Legalising the increasingly popular ride-sharing services became urgent in March when an Egyptian court ordered their suspension after a group of taxi drivers filed a suit, arguing they were illegally using private cars as taxis.

Another court last month stayed that ruling, allowing U.S.-based Uber and its Dubai-based competitor Careem to continue operating while the case is appealed. A higher court is expected to hear the appeal later this week.

Uber has faced regulatory and legal setbacks around the world amid opposition from traditional taxi services. It has been forced to quit several countries, such as Denmark and Hungary.

Uber has said Egypt is its largest market in the Middle East, with 157,000 drivers in 2017 and 4 million users since its launch there in 2014.

The new law stipulates that ride-sharing companies obtain five-year renewable licences for a fee of 30 million Egyptian pounds ($1.71 million) and that drivers pay annual fees to obtain special licences to work with the company.

“This is a major step forward for the ride-sharing industry as Egypt becomes one of the first countries in the Middle East to pass progressive regulations,” Uber said in a statement.

“We will continue working with the prime minister and the cabinet in the coming months as the law is finalised, and look forward to continuing to serve the millions of Egyptian riders and drivers that rely on Uber.”

The law also requires the companies to retain user data for 180 days and share it with authorities “on request” and “according to the law,” according to a copy of the law reviewed by Reuters.

An earlier draft of the bill had called for real-time data sharing by the companies, but that prompted some opposition in parliament due to privacy concerns.

The law must now be ratified by President Abdel Fattah al-Sisi.

Uber said last year it was committed to Egypt despite challenges presented by sweeping economic reforms and record inflation. In October, Uber announced a $20 million investment in its new support center in Cairo.

It has had to make deals with local car dealerships to provide its drivers with affordable vehicles and adjust its ride prices to ensure its workers were not hit too hard by inflation.

($1 = 17.5900 Egyptian pounds)