Article 101 [source]

Spanish Criminal Code
English translation

1. A person declared exempt from criminal responsibility pursuant to Article 20, paragraph 1, may be subject, if necessary, to the measure of confinement for medical treatment or special education in an establishment appropriate to the type of mental anomaly or disorder observed, or any other measure 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 person been found responsible; the Judge or Court shall specify this maximum limit in the judgment.

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