If a ship is finally detained under this Chapter, or if it appears that a ship provisionally detained was at the time of such detention unsafe, or if a ship is detained in pursuance of any provisions of this Chapter which period for the detention of a ship until a certain event occurs, the owner of the ship shall be liable to pay to the Federal ...