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 to Hungary because during his travel he was stopped by Rus' troops. King Stephen I of Hungary wasn't favorable to accepting him in his country. Without alternatives, Mieszko II went to Bohemia. Duke Oldřich once again imprisoned him. This time the King wasn't counting with the Imperial support. Mieszko II was not only imprisoned but also castrated, which was to be a punishment to Bolesław I the Brave, who blinded Duke Boleslaus III the Red (Oldřich's brother) thirty years before. Mieszko II and his wife never reunited again; according to some sources they were either officially divorced or only separated.