(4) Where the Director considers a ship unsafe, or, a passenger ship unfit to carry passengers, or where the machinery or equipment of a ship is defective in any way so as to expose persons on board to serious danger, the Director shall detain that ship, and the Director may also detain any ship in respect of which any of the provisions of this Act have not been complied with, if in the Director's opinion such detention is warranted in the circumstances.