John's grandson Count Bernard VII of Armagnac sold the county to Duke Philip II of Burgundy in 1390. It thus became part of the Duchy of Burgundy and the title 'Count of Charolais' was systematically given to the heir apparent of the incumbent duke. After the death of the last Valois-Burgundy duke Charles the Bold at the 1477 Battle of Nancy, the county was seized by King Louis XI of France–against the fierce resistance by the Habsburg archduke Maximilian I of Austria, husband of Charles' daughter Mary. The same year however, loyal to the duchess Mary, daughter of Charles the Bold, the County of Charolais rebelled and expelled the french. After the War of the Burgundian Succession, Charolais legally returned to the Habsburg dynasty according to the 1493 Treaty of Senlis, though it remained a French fief. Isolated in french lands the County of Charolais, former inheritance of the heir of the ducal throne, remained the last reminder of the Burgundian independence, when Burgundy was ruled by the most powerful, rich and sophisticated men of their times, the Great Dukes of Burgundy of House Valois-Burgundy, also known as the Great Dukes of the West.