The law says
IRPA s. 6060 For the purposes of this Division, it is affirmed as a principle that a minor child shall be detained only as a measure of last resort, taking into account the other applicable grounds and criteria including the best interests of the child.
Justice Laws is the authoritative version. If this copy and it ever differ, Justice Laws wins.