The Algerine privateering against Spanish vessels increased following the disastrous invasion of Algiers in 1775. Spain tried to reach a peace agreement with the Ottoman Regency with the aim of securing their commercial traffic along the Mediterranean. Don Juan de Bouligny was sent to Constantinople in 1782 and managed to obtain a friendship and commercial agreement with Sultan Abdul Hamid I. The Regency, nevertheless, denied to accept the treaty. The Dey, influenced by several of his officers, the "fasnachi", the treasurer, the "focha", the "Codgia" of the cavalry and the "Aga" of the infantry, opted for war, ignoring the recommendations of his naval officers. The Spanish chief minister, the Count of Floridablanca, then tried in vain to bribe the Dey with gold to open negotiations for peace.