Upon abandonment of a mine and thereafter, the owner or operator must effectively close or fence off all surface openings down which persons could fall or through which persons could enter. Upon or near all such safeguards, trespass warnings and appropriate danger notices shall be posted. The director of the mining and minerals division of the energy, minerals and natural resources department may bring an action in the district court in which the mine is located to compel the safeguarding of an abandoned mine. In the event of an immediate danger to public health and safety, the director of the mining and minerals division may take all action necessary to safeguard the abandoned mine and recover reasonable costs for such work from the owner of the mine.