 Complete the following phrase:  Málaga, as headquarters of the Capitanía General de Granada Captaincy General of the Kingdom of Granada on the coast played an essential role in the foreign policy of the Bourbon kings of Spain. The regional military, the supply of the North African presidios, and the defence of the Mediterranean were administered in the city. This involved massive defence spending on fortification of the harbor, the building of coastal towers and the organising of militias. The loss of Gibraltar to a Second Grand Alliance force and an inconclusive naval engagement 