Article 534 [source]

Spanish Criminal Code
English translation

1. Any public official or officer who, in the course of a criminal case, and without respecting constitutional or legal guarantees:

1. Enters a dwelling without the consent of the occupant

2. Searches a person's papers or documents or the effects found in their dwelling unless the owner has freely given their consent

Shall be punished with a fine of six to twelve months and special disqualification from public employment or office for two to six years. If the official or officer fails to return the searched papers, documents, and effects to the owner immediately after the search, the penalties shall be special disqualification from public employment or office for six to twelve years and a fine of twelve to twenty-four months, without prejudice to any penalty that may apply for misappropriation.

2. Any authority or public official who, during a lawful search of a person's papers, documents, or effects, commits any unjust harassment or unnecessary damage to their property, shall be punished with the penalties provided for these acts, imposed in their upper half, and, in addition, with the penalty of special disqualification from public employment or office for a period of two to six years.