Relatively little is known of Casimir's early life. Born to
Mieszko II of Poland and
Richensa of Lotharingia, the granddaughter of
Emperor Otto II, he must have spent his childhood at the royal court of Poland in
Gniezno. Mieszko II was crowned the king of Poland in 1025 after his father's death. The many landlords, however, feared the single rule of the monarch. This situation led to conflicts in the country, in which Mieszko's brothers turned against him and the Emperor
Conrad II's forces attacked the country, regaining
Lusatia. Years of chaos and conflict followed, during which Mieszko died (1034) in suspicious circumstances after his forced abdication and a brief restoration.
After the death of her husband, Richensa probably tried to seize the power in the country and secure the crown for her son. However, she failed and Casimir had to flee to the
Kingdom of Hungary while the central parts of Poland were controlled by
Bezprym. The region of
Greater Poland revolted against the nobles and clergy and a mass
pagan revival ensued there. Also the land of
Masovia seceded and a local landlord named
Miecław formed a state of his own there. A similar situation happened in
Pomerania, where the power was held by a local independend dynasty loosely related to the Piasts. Duke
Bretislaus I of
Bohemia, observing the period of turmoil in Poland, took advantage of his neighbour's weakness and invaded the country. After a short struggle he regained control of
Silesia and
Lesser Poland and severely pillaged Greater Poland, burning Gniezno to the ground and looting the
relics of
Saint Adalbert.
The following year the new
Holy Roman Emperor, Henry III, allied himself with the exiled Polish ruler against the Bohemians. Casimir was given a troop of 1,000 heavy footmen and a significant amount of gold to restore his power in the country. Casimir also signed an alliance with
Yaroslav I the Wise, the Prince of
Kievan Rus'. The alliance was sealed by Casimir's marriage with Yaroslav's sister,
Maria Dobronega. With such support Casimir returned to Poland and managed to retake most of his domain. In
1041, the defeated Bretislaus signed a treaty at
Regensburg in which he renounced his claims to all Polish lands except for Silesia, which was to be incorporated into the Crown of Bohemia. It was Casimir's success in strengthening royal power and ending internal strife that earned him the epithet of "the Restorer".
The treaty gained Casimir a period of peace at the southern border and the capital of Poland was moved to
Kraków, the only major Polish city relatively untouched by the wars. It is probable that the Holy Roman Emperor was happy with the balance of power restored in the region and forced Casimir not to crown himself the king of Poland. In 1046 Emperor Henry held royal and imperial courts at
Merseburg and
Meißen, at which he ended the strife among the
Dux Bomeraniorum (Duke of
Pomerania), Duke Bretislaus of
Bohemia, and Poland's Casimir I. In
1047 Casimir, aided by his Kievan ally, started a war against Masovia and seized the land. It is probable that he also defeated Miecław's allies from Pomerania and attached
Gdańsk to Poland. This secured his power in central Poland. Three years later, against the will of the emperor, Casimir seized Bohemian-controlled Silesia, thus securing most of his father's domain. In 1054 in
Quedlinburg the Emperor ruled that Silesia was to remain in Poland in exchange for a yearly tribute of 117 kilograms of silver and 7 kg of gold.
At that time Casimir focused on internal matters. Conflicted with the Emperor in the Silesian case, he supported the
Papacy in the
Investiture Controversy and gained the support of the church. To strengthen his rule he re-created the bishopric in Kraków and
Wrocław and erected the new
Wawel Cathedral. During Casimir's rule
heraldry was introduced in Poland and, unlike his predecessors, he promoted landed gentry over the
drużyna as his base of power. One of his reforms was the introduction, to Poland, of a key element of
feudalism: the granting of
fiefdoms to his retinue of warriors, thus gradually transforming them into medieval
knights.