Image copyright Getty Images

Apple has removed an app that protesters in Hong Kong have used to track police movements and tear gas use, saying the app violated its rules.

The company said the app, HKmap.live, had "been used in ways that endanger law enforcement and residents".

Apple initially rejected the app - which uses data from protesters on the ground - from its store.

When it later appeared on the App Store, there was a sharply-worded response in official Chinese media.

The removal then came after "many concerned customers in Hong Kong contacted us", Apple said.

"We have verified with the Hong Kong Cybersecurity and Technology Crime Bureau that the app has been used to target and ambush police," Apple said.

The statement added that "criminals have used it to victimise residents in areas where they know there is no law enforcement".

Although the app has been removed from Apple's store, a website version appears to remain active. There is also a version on Google Play.

When the app was available on the App Store, Apple was criticised in Chinese state media.

Communist Party publication the People's Daily didn't name the app, but criticised Apple for "opening the door" to violent protests.

"Letting poisonous software have its way is a betrayal of the Chinese people's feelings," the paper said.

Apps previously have been removed after their release if they were found to facilitate illegal activity or threaten public safety.

Media playback is unsupported on your device Media caption The weekend saw riots over the mask ban, a second person shot, and tear gas fired at protesters

A number of companies have drawn the ire of Chinese officials over the long-running Hong Kong protests.

China's state broadcaster has scrapped plans to show two US NBA basketball pre-season games over a pro-Hong Kong tweet from a team manager, and sponsors have also been critical.

Jeweller Tiffany & Co scrapped an advert image after some Chinese consumers suggested it was supportive of the protesters.

And California-based Video-game company Blizzard suspended a gamer after he expressed support for the protestors during a livestream.

Hong Kong protesters, meanwhile, the other hand, have targeted mainland banks and what they perceive to be pro-mainland businesses.

For Apple, China is both a major market and a manufacturing base for its products.

The manufacturing of Apple products directly and indirectly accounts for around three million jobs in China.

Apple had sales of $9.61bn last quarter in its Greater China category, which includes Taiwan and Hong Kong.