The compound was one of the early Spanish missions in Texas, built for the education of area Native Americans after their conversion to Christianity. In 1793, the mission was secularized and then abandoned. Ten years later, it became a fortress housing a military unit, the Second Flying Company of San Carlos de Parras, who likely gave the mission the name Alamo. During the Texas Revolution, Mexican General Martin Perfecto de Cos surrendered the fort to the Texian Army in December 1835, following the Siege of Béxar. A relatively small number of Texian soldiers then occupied the compound for several months. They were wiped out at the Battle of the Alamo on March 6, 1836. When the Mexican army retreated from Texas several months later, they tore down many of the Alamo walls and burned some of the buildings.