Iribarren ordering a battalion to the Legion's support, Colonel Conrad determined that the attack had little chance of success and ordered a retreat. The Legion was able to take about one third of their wounded in the retreat. However the Battle of Huesca proved to have had a substantial toll on the Legion's strength: 350 legionaries and 28 officers died in the battle. The timing of the Battle of Huesca was unfortunate as shortly thereafter the enlistments of nearly 1,000 men ran out. This departure of so many men combined with the casualties from Huesca reduced the Legion's strength to a single battalion. The Legion was positioned on the right flank of the Spanish army's line of battle and in a coincidence, the Legion fought a force of foreign volunteers and mercenaries in Carlist employ. The Spanish forces to the Legion's left broke rank and retreated under the Carlist onslaught, leaving the Legion encircled as it fought on. Colonel Conrad, attempting to rally his men to attack, proceeded out in front of his skirmish line inciting his men to march forward, however he was struck and killed by a bullet, becoming the first commander of the Foreign Legion to die in battle. Without a leader and demoralized, the Legion withdrew from the field. Following the death of Colonel Conrad, command of the Foreign Legion was assumed by Lieutenant-colonel Andrè Camille Ferray. The Legion finally returned to France in January 1839 with only 63 officers and 159 enlisted remaining of the original 4,000 men who were deployed to Spain. Second Deployment to Algeria In 1836 the French government decided that instead of deploying the reinforcements intended for the Foreign Legion to Spain, as the issue had become politically volatile, the intended reinforcements would be formed into a second Foreign Legion and deployed to Algeria. By December 15, 1836, the first elements of the Foreign Legion, a battalion numbering around 1,600 men, had reached Algeria led by Major Bedeau. In 1839 many of the defeated Carlist forces sought refuge in France from retribution of the Spanish government. The French government resorted to a familiar method of unburdening itself of unwanted refugees, offering Carlist refugees enlistment in the Foreign Legion. On October 1, 1839, the 4th Battalion of the Foreign Legion was officially established at its depot at Pau from many of these refugees. By March 1840, three of its companies had arrived