Due to the proximity of the city to the sea (about away) and the danger of attack by pirates and privateers, the Wall of Trujillo was built for defense during the reign of Viceroy Melchor de Navarra and Rocafull and the city mayors Bartolome Martinez and Fernando Ramirez Jarabeitia Orellana. This wall was built by an Italian architect, Giuseppe Formento, who began construction on February 19, 1687. Formento based his design on that by Leonardo da Vinci for the Italian city of Florence. The wall was designed in an elliptical shape to save costs in its construction, and was completed in 1689. The wall reached a perimeter of and used more than 100,000 bricks. The defensive structure was composed of 15 bastions, 15 shades and 5 covered gates.