Spanish police have arrested 69 people allegedly connected to a criminal gang that hacked an online booking system for police appointments and resold the sessions to asylum seekers and other foreigners seeking residency.

Police said the gang's automated software application - or bot - was able to bypass measures designed to identify robots, allowing it to book "practically all" of the appointments across Spain that are normally free and resell them for as much as 200 euros each.

In Spain, people seeking asylum or a residency visas must present documents to the police, for which long waits are common.

The leaders of the gang set up a company that rented out the bot out to intermediaries who then sold the appointments.

A police statement said the intermediaries as well as lawyers and advisers were aware of the existence of a hack "and of the corresponding problems they were causing to foreigners who, on many occasions, were in a situation of great vulnerability and desperation".