By 1003 Boleslaw the Brave had incorporated all of Moravia into the Polish state, and it remained in Polish hands until 1031. Under Mieszko II, Moravia passed into Czech rule.
Moravia became part of the Přemyslid state of Bohemia, and Olomouc became a royal city. In 1306, King Wenceslas III, on an expedition to Poland (he was the titular king of Poland), stopped in Olomouc, where he was stabbed to death near the cathedral by a mercenary German soldier. Konrad of Botenštejn. The result of this assassination was the extinction of the Přemyslid dynasty in the male line.