Poland to form into a recognizable unitary and territorial entity around the middle of the 10th century under the Piast dynasty. Poland's first historically documented ruler, Mieszko I, accepted Christianity with the Baptism of Poland in 966, as the new official religion of his subjects. The bulk of the population converted in the course of the next few centuries. In 1000, Boleslaw the Brave, continuing the policy of his father Mieszko, held a Congress of Gniezno and created the metropolis of Gniezno and the dioceses of Kraków, Kołobrzeg, and Wrocław. However, the pagan unrest led to the transfer of the capital
Mieszko II Lambert name for his son was an expression of warming relations between Bolesław I and his stepmother Oda. He organized two devastating invasions to Saxony in 1028 and 1030. Then Mieszko II ran a defensive war against Germany, Bohemia and the Kievan princes. Mieszko II was forced to escape from the country in 1031 after an attack of Yaroslav I the Wise, who installed Mieszko's older half-brother Bezprym onto the Polish throne. Mieszko took refuge in Bohemia, where he was imprisoned by the Duke Oldrich. In 1032 he regained power in one of the three districts, then united the country, making