Section 22. An agent of the department shall visit each family foster home, not supervised and approved by a licensed placement agency, at least once a year and may be authorized by the department to remove a child to its care if, in its judgment, the welfare of the child or its protection from neglect or abuse so require. An agent who is refused entry or hindered in the removal of such child may make complaint, on oath, to a justice of the court having jurisdiction, who may thereupon issue a warrant authorizing the agent to obtain sufficient aid and, at any reasonable time, enter the building designated, and any part thereof, to investigate the treatment and condition of a child found there and to remove the child as herein provided. The department shall take the child temporarily into its care, immediately notify the child’s parent or legal guardian and, upon request, discharge the child to a parent or legal guardian. If the parent or legal guardian is unable or refuses to make suitable provisions for the child, the department shall make lawful provisions for the child’s care under section 23 or 24.