Article 102 [source]

Spanish Criminal Code
English translation

1. Those exempt from criminal liability pursuant to Article 20, paragraph 2, shall be subject, if necessary, to the measure of confinement in a public or duly accredited or approved private rehabilitation center, or any other of the measures provided for in Article 96, paragraph 3. The confinement may not exceed the length of the term of imprisonment that would have been imposed had the individual been found responsible; the Judge or Court shall set this maximum limit in the judgment.

2. Those subject to this measure may not leave the facility without authorization from the sentencing Judge or Court, in accordance with the provisions of Article 97 of this Code.