Uber has been using a secret tool in countries across the world in order to avoid law enforcement authorities, it has been revealed.

Greyball, a tool which uses geolocation data, credit card information and social media account data, has been used by the company for years in order to identify and avoid officers aiming to catch drivers out in cities where the discount cab firm is not permitted.

Rides hailed from a location near a city enforcement agent suspected of launching a sting to specifically trap Uber drivers could be ignored or cancelled using the app, The New York Times reported.

The tool allowed Uber to show law enforcement officers images of “ghost” cars on the app or show that no cars were available for use, the paper said.

Uber defended the programme, adding in a statement that the company “denies ride requests to fraudulent users who are violating our terms of service – whether that’s people aiming to physically harm drivers, competitors looking to disrupt our operations, or opponents who collude with officials on secret ‘stings’ meant to entrap drivers.”

A spokeswoman for Uber confirmed that Greyball was still in use, though on a much smaller scale than it once was.

She added the tool had in fact grown in use as part of efforts to protect the group’s drivers from abuse as well as protect the app from disruption by competitors. In some cases, she said, the tool had been used where there were enforcement stings.

Uber has come under fire as of late, defending accusations of unfair working conditions and allegations of sexual harassment within the company and employee abuse.

Last week investors attacked the company for failing to address its culture of “bullying”, “lack of diversity” and “harassment in every form”.

On Friday, Uber’s best-known security researcher resigned without stating any reasons why, leading to speculation over whether there had been a link to the Greyball tool.

Rival company Alphabet has also accused Uber of stealing designs for technology for self-driving cars – a claim Uber has denied.

A spokesperson said Uber’s legal department had approved the practice in locations where Uber was not overtly banned, and that Uber’s terms of use required riders use the ride hailing app for personal, not commercial, reasons and to not cause “nuisance” to drivers.

The program began under a different name in 2014, and is still being used when drivers are under threat of arrest or other legal punishment in some cities within 15 U.S. states without clear ride-sharing laws, she said, adding that she did not know in which other countries the system is being used.

The New York Times reported that Uber had used the tool to evade authorities in Boston, Paris and Las Vegas, and countries includes Australia, China, Italy and South Korea.

US officials have expressed concern about Uber’s practices but stopped short of saying they will take action.