While travelling to Spain with his family onboard a Spanish Navy squadron in 1804, a Royal Navy fleet attacked the squadron on 5 October, capturing or destroying all four of the Spanish frigates present. The battle was a preamble to the Anglo-Spanish War between the two countries; during the engagement, Alvears's brothers and mother were killed by stray cannon fire, though he survived the battle to be taken as a prisoner of war by the British along with his father to England. There, he would meet and marry an Irish woman.