Fort Jesus was captured and recaptured at least nine times between 1631, when the Portuguese lost it to the Sultan Yusuf ibn al-Hasan of Mombasa, and 1895 when it fell under British rule and was converted into a prison.