How does the sentence end?

The captain went into the harbor in order to replace the ship anchor and kept the chain because the
anchor was broken.