Article 507 [source]

Spanish Criminal Code
English translation

The Judge or Magistrate who assumes administrative powers that he does not possess, or prevents their legitimate exercise by the person who holds them, shall be punished with a prison sentence of six months to one year, a fine of three to six months and suspension from employment or public office for a period of one to three years.