The first fort was a structure of palm logs and earth. Most of it was destroyed when the city was invaded by Chinese pirates led by Limahong. Martin de Goiti was killed during the siege. After a fierce conflict, the Spaniards under the leadership of Juan de Salcedo, eventually drove the pirates out to Pangasinan province to the north, and eventually out of the country.