If, in the opinion of the principal of any 24-hour school, the further detention of any minor is detrimental to the minor, the minor may upon order of the principal be returned to the county superintendent or superintendent of schools of the district, as the case may be, in which the school is located or to the court which committed him, as may seem necessary for the best interest of the child.