Charles was the youngest child of Louis VIII of France and Blanche of Castile. The date of his birth was not recorded, but he was probably a posthumous son, born in early 1227.[note 1] Charles was Louis's only surviving son to be "born in the purple" (after his father's coronation), a fact he often emphasised in his youth, according to Matthew Paris. He was the first Capet to be named for Charlemagne.
Louis willed that his youngest sons were to be prepared for a career in the Roman Catholic Church. The details of Charles' tuition are unknown, but he received a good education. He understood the principal Catholic doctrines and could identify errors in Latin texts. His passion for poetry, medical sciences and law is well documented.
Charles said that their mother had a strong impact on her children's education. In reality, Blanche was fully engaged in state administration, and could likely spare little time for her youngest children. Charles lived at the court of a brother, Robert I, Count of Artois, from 1237. About four years later he was put into the care of his youngest brother, Alphonse, Count of Poitiers. His participation in his brothers' military campaign against Hugh X of Lusignan, Count of La Marche, in 1242 showed that he was no longer destined for a Church career.
Provence and Anjou
Raymond Berengar V of Provence died in August 1245, bequeathing Provence and Forcalquier to his youngest daughter, Beatrice, allegedly because he had given generous dowries to her three sisters. The dowries were actually not fully discharged, causing two of her sisters, Margaret (Louis IX's wife) and Eleanor (the wife of Henry III of England), to believe that they had been unlawfully disinherited. Their mother, Beatrice of Savoy, claimed that Raymond Berengar had willed the usufruct of Provence to her.
Emperor Frederick II, Count Raymond VII of Toulouse and other neighbouring rulers proposed themselves or their sons as husbands for the young countess. Her mother put her under the protection of the Holy See. Louis IX and Margaret suggested that Beatrice should be given in marriage to Charles. To secure the support of France against Frederick II, Pope Innocent IV accepted their proposal. Charles hurried to Aix-en-Provence at the head of an army to prevent other suitors from attacking. He married Beatrice on 31 January 1246. Provence was a part of the Kingdom of Arles and so of the Holy Roman Empire, but Charles never swore fealty to the emperor. He ordered a survey of the counts' rights and revenues, outraging both his subjects and his mother-in-law, who regarded this action as an attack against her rights.
Being a younger child, destined for a church career, Charles had not received an appanage (a hereditary county or duchy) from his father. Louis VIII had willed that his fourth son, John, should receive Anjou and Maine upon reaching the age of majority, but John died in 1232. Louis IX knighted Charles at Melun in May 1246 and three months later bestowed Anjou and Maine on him. Charles rarely visited his two counties and appointed baillies (or regents) to administer them.
While Charles was absent from Provence, Marseilles, Arles and Avignon—three wealthy cities, directly subject to the emperor—formed a league and appointed a Provençal nobleman, Barral of Baux, as the commander of their combined armies. Charles' mother-in-law put the disobedient Provençals under her protection. Charles could not deal with the rebels as he was about to join his brother's crusade. To pacify his mother-in-law he acknowledged her right to rule Forcalquier and granted a third of his revenues from Provence to her.
In December 1244 Louis IX took a vow to lead a crusade. Ignoring their mother's strong opposition his three brothers—Robert, Alphonse and Charles—also took the cross. Preparations for the crusade lasted for years, with the crusaders embarking at Aigues-Mortes on 25 August 1248. After spending several months in Cyprus they invaded Egypt on 5 June 1249. They captured Damietta and decided to attack Cairo in November. During their advance Jean de Joinville noted Charles' personal courage which saved dozens of crusaders' lives. They were unable to reach Cairo because Egyptian troops surrounded them on 6 April 1250. Charles was captured along with his brothers. They were released in exchange of 800,000 bezants and the surrender of Damietta on 6 May.
During their voyage to Acre, Charles outraged Louis by gambling while the king was mourning the recent death of their brother, Robert of Artois. Louis remained in the Holy Land, but Charles returned to France in October 1250.