Following the death of his father,
Casimir I Boleslaw as "senior" inherited
Greater Poland, Lesser Poland as well as
Mazovia, Pomerania, and
Silesia districts of the Kingdom. His brothers
Władysław Herman and Mieszko became governors of the remaining provinces, however Mieszko died relatively early, in 1065, at which point his lands came under the authority of the "senior". Boleslaw II based his foreign policy on surrounding his realm with allied kingdoms in order to oppose Germany and the
Holy Roman Empire; his goal being for Poland to one day border only with allied countries. This is the reason behind his numerous foreign interventions: In
1060-1063 he intervened in
Hungary to aid
Béla I of Hungary and his sons against the Holy Roman Empire who in
1061 with the support of Polish troops, gained power in Hungary. In Hungary Boleslaw II pursued the policy of cooperation with the anti-imperial faction which allowed him to gain political independence from the Empire but put him in conflict with the pro-imperial kingdom of Bohemia. He escalated the conflict with
Vratislaus II of Bohemia, by refusing to pay annual homage to Bohemia and spurring the Czech nobility to revolt against him. In
1063, Bolesław besieged the
Moravian city of
Hradec but, defeated, he was forced to retreat. Relationships with Vratislaus II were however settled to a certain extent when the latter married Świętosława, Bolesław's sister.
Also in 1063 Bela of Hungary died: Bolesław's return in
Hungary could not defend the cause of his son
Géza against the German troops of
Emperor Henry IV, who installed
Solomon on the Hungarian throne.
In
1069 Iziaslav I of Kiev and Gertruda (the daughter of
Mieszko II of Poland) were overthrown. The military campaign of Bolesław established them back in power in
Kiev. In
1071 Bolesław attacked Bohemia again. As the Polish refused any attempt of arbitration by Henry IV, the question was settled by an armistice between the two belligerents; however Bolesław, ignoring the treaty, renewed his attack in 1072 and refused to pay the tributes from Silesia to the
Holy Roman Empire.