Unable to determine friend from foe in the darkness, Real Carlos inadvertently engaged the Spanish ship San Hermenegildo, spreading the fire to its compatriot.
A second stage of the battle then developed, as HMS Venerable took the lead of the British line, attacking the rearmost French ship Formidable under Captain Amable Troude.
In a furious and protracted engagement, Venerable suffered heavy damage and was driven ashore, allowing the remainder of the French force to return to Cadiz without further fighting.
This British victory, coming so soon after Saumarez's defeat in Algeciras harbour, did much to restore parity in the region and the heavy casualties inflicted on the Spanish contributed to a weakening of the Franco-Spanish alliance and the signing of Treaty of Amiens, which brought the war to a temporary halt early the following year.
[1] A squadron sailed from Brest on the Atlantic in January and made three failed attempts to reach Egypt, which was facing a large British invasion, before abandoning the effort and retiring to Toulon on the French Mediterranean coast.
Three ships of the line, Formidable, Indomptable and Desaix, had been detached from the squadron in May however and were subsequently placed under the command of Contre-Admiral Charles Linois under orders to sail for Cadiz.
[4] Saumarez was informed of Linois's arrival, and turned eastwards to confront him, discovering the French ships anchored in a well prepared position on the morning of 6 July.
[5] With no wind with which to manoeuvre and the squadron's boats all either sunk or engaged in towing the battered HMS Pompée back to Gibraltar, Saumarez called off the attack at 13:35.
[7] At Cadiz, le Pelley had to plead with Mazzaredo for assistance, the Spanish admiral agreeing on 8 July to send a powerful squadron under Vice-Admiral Juan Joaquín Moreno de Mondragón to Algeciras.
[9] The combined squadron sailed from Cadiz on 9 July, progressing rapidly southwards and reaching Algeciras Bay late in the afternoon, except for Saint Antoine which was delayed and arrived the following morning.
[8] At the British port, the dockyards were the scene of frantic activity as Saumarez, supported by commissioner Captain Alexander Ball, sought to repair his squadron so that it could intercept Moreno's forces on their voyage back to Cadiz.
The arrival of a light easterly wind which would favour passage back to Cadiz encouraged both Moreno and Saumarez to prepare for departure to the Atlantic base on the following day.
[13] At 12:00 on 12 July, Caesar warped out of Gibraltar dockyard with her band playing the popular song "Heart of Oak" to the answering strains of "Britons, Strike Home!"
[9] Moreno's departure had been delayed due to the state of the captured Hannibal, renamed Annibal, which was unable to make any progress under its jury masts and had been taken under tow by the frigate Indienne.
Sighting Saumarez's force, Moreno instructed Indienne and Hannibal to return to Algeciras and at 19:45 issued orders for the remainder of the squadron to sail west through the Gut of Gibraltar towards Cadiz.
The wind soon freshened to a hard gale in the Straits and with foresail and top-gallants set the Superb went at 11 1/2 knots and by 22:00 had regained sight of the combined squadron's rearguard,[18] which consisted of the 112-gun ships and the Saint Antoine.
[20] With Real Carlos disabled, Keats pushed on into combat with Saint Antoine, the combined French and Spanish crew engaging the British vessel as it approached.
[22] Formidable was also to the rear of the combined squadron, escaping attack by feigning British signal lights until it had safely passed the battle between Superb and Saint Antoine.
The fire was too dangerous for British ships to make any rescue attempts,[21] and although several hundred men managed to escape the wrecks on small boats, there were still more than 1,700 sailors on board when first the Real Carlos at 00:15 and then the San Hermenegildo at 01:00 exploded as the flames reached their central magazines, killing both crews.
262 survivors in boats were taken aboard the captured Saint Antoine and 38 on Superb, while a handful managed to reach the rest of the Franco-Spanish squadron,[26] but the enormous loss of life in this incident was one of the worst maritime disasters to that time.
[28] Saumarez sent Jahleel Brenton in a gig to Venerable at 08:00, just as the foremast also fell overboard, with instructions that if the combined French and Spanish squadron, visible off Cadiz, should proceed south to attack the grounded British vessel then Hood should remove his crew and set his ship on fire.
Eventually the arrival of Audacious and Superb on the southern horizon decided the issue as Moreno abandoned any intention to counterattack, instead entering Cadiz harbour with his squadron, followed by Troude in Formidable.
[28] Hood's ship was taken under tow by first Thames and then Spencer, the British squadron turning back towards Gibraltar at 18:00, the crew rigging a series of jury masts and sails to assist the process.
[28] In addition, the Spanish 34-gun frigate Perla was seen wallowing off the North African coast of the Strait of Gibraltar on the morning of 13 July, sinking later in the day due to severe damage.
[33] The first lieutenants of Caesar, Superb and Venerable were promoted to commander and the captured Saint Antoine was commissioned into the Royal Navy as HMS San Antonio, although the age and small size of the ship meant that she was never suited to front-line service and was instead stationed permanently at Portsmouth.
With the French plan to reinforce the army stranded in Egypt in ruins, the British invasion fleet was free to operate without interference, succeeding in capturing the country in September.
[38] In Spain the government, furious at the losses suffered for so little gain, began to distance themselves from the alliance with France, which was a contributing factor in the signing of the Treaty of Amiens in March 1802 that ended the French Revolutionary Wars.