The officer executing a search warrant may break open any building, structure, or container or anything therein to execute the warrant if, after giving notice of his authority and purpose, he is refused admittance. An officer executing a search warrant may break open any building, structure, or container or anything therein for the purpose of liberating a person who, having entered to aid him in the execution of a warrant, is detained therein, or when necessary for his own liberation.
SDCL 23A-35-8