Article 402 [source]

Spanish Criminal Code
English translation

Anyone who unlawfully performs acts proper to an authority or public official, attributing to himself an official character, shall be punished with a prison sentence of one to three years.