Article 1 [source]

Spanish Criminal Code
English translation

1. No action or omission shall be punished unless it is defined as a crime by a law enacted prior to its commission.

2. Security measures may only be applied when the conditions previously established by law are met.