By 1612, when Moscow was occupied by Polish invaders, Hermogen had become Patriarch of Moscow and All Russia. From prison, he called for a three-day fast and ordered the icon of Our Lady of Kazan to be brought to Princes Minin and Pozharsky, who were leading the resistance to the occupation. This icon—possibly the original, but more likely a copy—was carried before their regiments as they fought to regain the capital from the Poles. When the Polish army was finally driven from Moscow on October 22, 1612, the victory was attributed to the intercession of the Mother of God, and the Kazan icon became a focal point for Russian national sentiments. Later that year, when Tsar Mikhail Feodorovich came to the throne, he appointed both July 8 and October 22 as feasts in honor of Our Lady of Kazan.The victorious Prince Dmitry Pozharsky financed the construction of a small wooden church dedicated to the Virgin of Kazan in the Moscow Kremlin. The icon was kept there until the small church burnt down in 1632. The tsar ordered the construction of a larger brick cathedral to replace it. After its completion in 1638, the icon remained there in Moscow's Kazan Cathedral for nearly two centuries. It was regularly borne in solemn liturgical processions along the city walls as the protectress of Moscow. The intercession of Our Lady of Kazan was successfully invoked against a Swedish invasion in 1709, and again when Napoleon invaded Russia in 1812. To commemorate this latter victory, the Kazan icon was moved to the new Kazan Cathedral in St. Petersburg in 1821.