Interesting article in Spanish from Las Provincias newspaper.
Explains how the scam worked:
The constructor requested planning permission to put a fence around protected land.
The council gave planning permission and this, in turn, enabled the constructor to request a temporary supply of electricity and water for the construction works. This supply was then channelled to the illegally built houses.
As the houses were completed, the council then issued certificates stating that were more than four years old and so safe from demolition for having been built illegally.
At the same time, the council decided not to issue a request to the property registry that would have blocked any land transfers (ie sales).
Part of the undoing of the scam has been the publication of old aerial photos showing that the houses were less than four years old.