Ferdinand I remained in prison until the Kingdom of Great Britain captured and occupied Manila during the Seven Years' War in 1762. The following year, he was restored to the throne by the British, upon whose departure from Manila after the signing of the Treaty of Paris saw raids by Sulu pirates on the city intensify.