La Liga has been forced to admit that its official mobile app eavesdropped on users in order to identify illegal broadcasts of matches.

The app was able to detect the location of users and if they were in a public place, such as a bar, it would automatically record an audio clip via their device’s in-built microphone.

An algorithm would then identify whether they were watching football and cross-check it with their location to confirm whether the bar’s owner was legally licensed to broadcast La Liga matches.

Spanish football’s governing body has denied any wrongdoing, and says users were asked permission to grant access to their location and microphone when they signed up for the app.

It also denied any of the audio recordings had been listened to by league employees.

According to El Diario, the app has been downloaded 10 million times around the world, but La Liga says users outside of Spain were never spied on.

Illegal streaming is said to cost the league approximately €150m per year, and other leagues have also taken steps in recent years to combat piracy.

UEFA and the English Premier League have both obtained High Court permission to block illegal streaming in the UK, while in 2016, Spanish police raided an internet service provider known as Y Internet, which allegedly provided unauthorised online subscription services for pay-TV channels.