By July 1801, "San Hermenegildo" was at Cádiz. When a French squadron repelled a British force at the First Battle of Algeciras on 6 July, "San Hermenegildo" joined the squadron sent to escort the French from Algeciras back to Cádiz. During the night of 12 July the combined force was returning through the Straits of Gibraltar when a British squadron attacked them at the Second Battle of Algeciras. During the confused night action which followed, HMS "Superb" cut through the rearguard and between "Real Carlos" and "San Hermenegildo". The Spanish ships opened fire, striking one another, as a fire spread across "Real Carlos"'s decks. In the darkness the two huge Spanish ships collided, fire spreading out of control until both exploded in a fireball that could be seen from shore. More than 1,700 men were killed in blast, one of the greatest losses of life at sea to that time.