One of the most researched aspects of the Dauphin's short life is the time he and his brother Henry (later Henry II of France) spent as hostages in Spain. The king had been badly defeated and captured at the Battle of Pavia (1525) and became a prisoner of Charles V, the Holy Roman Emperor, initially in the Alcázar in Madrid. In order to ensure his release, the king signed the Treaty of Madrid (1526). However, in order to ensure that Francis abided by the treaty, Charles demanded that the king's two older sons take his place as hostages. Francis agreed.