In 1795, the town, along with most of Lithuania, was annexed by Russia, becoming a part of the Vilna Governorate. In 1812 the Battle of Deltuva, between the Russian and French armies, occurred not far from Ukmergė; Napoleon's army raided the town during the French invasion of Russia. During the November Uprising in 1831, the city remained in the hands of rebel elements for several months.