At the end of the 18th century, the city was divided into several districts, each of which was ruled by a family, until 1799, when the Qajar Prince Abbas Mirza was appointed as the governor of the city. During the Qajar dynasty the city was the residence for the Crown Prince. The crown prince normally served as governor of Azerbaijan province as well. Some of the most important events in this period were the wars between Qajar Iran and neighbouring Imperial Russia. Prior to the forced cession of Iran's Caucasian territories—comprising what is now Georgia, southern Dagestan, Azerbaijan, and Armenia—to Imperial Russia following the two Russo-Persian Wars of the first half of the 19th century, Tabriz, being strategically located, was instrumental to the implementation of Iranian rule in its Caucasian territories. During the last Russo-Persian War, the Russo-Persian War of 1826–1828, the city was captured for Russia in 182 by General Prince Eristov, who marched into the city with 3,000 soldiers. After Abbas Mirza and Ivan Paskevich signed the peace treaty, which granted for the irrevocable cession of the last remaining Caucasian territories, the Russian army retreated from the city. Nevertheless, Russian political and military influence remained a major force in Tabriz and north-northwestern Iran even until the fall of the Russian empire in the early 20th century. After the retreat of the Russian army, Abbas Mirza, the Qajar Crown Prince, launched a modernization scheme from Tabriz, during which he introduced Western-style institutions, imported industrial machinery, installed the first regular postal service, and undertook military reforms in the city. He also began a rebuilding campaign and established a modern taxation system.