The Supreme Court of Canada held in the Swain case (1991) that section 542(2) of the Criminal Code (now section 614) was intra vires the federal Parliament or, in other words, valid. This section dealt with the automatic detention of a person found not guilty by reason of mental incapacity. Such detention was under the supervision of the lieutenant governor for an indeterminate period. The true purpose of the legislative regime established by section 542(2) of the Criminal Code is the protection of society against dangerous individuals. This preventive function is an essential part of the criminal law; it has been recognized for a lengthy period of time in both cases and legal doctrine. However, because of section 7 of the Canadian Charter of Rights and Freedoms, which deals with liberty and security of the person, this preventive aspect was opposed to the Charter, the Court declared; the detention could only be for a determinate period.