The original purpose of the church was to show appreciation to God for the victory against the Russian army in the Battle of Vilnius during the Second Northern War, which started in 1655 and lasted until 1661. The construction of the church began in 1662 under the supervision of the Bishop of Vilnius Jerzy Biallozor. Biallozor died in 1665 and his heir, Bishop Aleksander Sapieha, took charge of the construction. In 1668, he entrusted the local Dominicans from the Convent of the Holy Spirit in Vilnius the supervision of the construction, which was validated by the Master of the Dominican Order in 1670. The church was solemnly consecrated on June 9, 1669 on the feast of Pentecost.