The time Anonymous hacked some unofficial Spanish police forums, leaking up to 11k records. [1]
The recent incident where a Zoom event called "Cybersecurity and online privacy" attended by Spanish police and civil guard members was hacked. After taking over, the attackers streamed child pornography. [2]
[1] https://www.abc.es/tecnologia/redes/abci-hackean-policia-nac...
[2] https://www.elespanol.com/omicrono/software/20200514/confere...
Show me an incident where the police were actually hacked. (I am not saying it has not happened, just that your proof is not proof of anything)
Usually, consulting firms such as Indra and Deloitte build and maintain them after getting publicly available contracts.
You make a good point because Spanish public servants have probably never had their own systems hacked, since pretty much all the stuff they use has been built by consulting firms or contractors.