In the Qajar Empire, this reform process was not as fast as it was in the Ottoman Empire. The Qajar Empire got help from Europe to make military reforms in the Qajar army. In 1812, the Qajar Empire tried to take back lands from the Russian Empire when the armies of Napoleon's First French Empire were attacking Russia. The British Empire helped the Qajar Empire with its reforms in the early the 19th century because the Russian Empire's growth was a threat to the British Empire's control of India. In 1828 (after the Russo-Persian War), the Russian Empire took control of all the lands and all the Kurdish tribes to the north of the Aras river. This was the agreement of the Treaty of Turkmenchay. The influence of the Russian Empire was growing in the north of Kurdistan, and the influence of the British Empire was growing in the south of Kurdistan. Many of the Kurdish rulers on the border between the Ottoman Empire and the Qajar Empire chose to work with the Ottoman Empire. This was because the most of the Kurds in the north of Kurdistan were part of Sunni Islam, like the Ottoman dynasty's sultan (and caliph) in Constantinople. (Other Kurds in the south of Kurdistan were part of Shia Islam, like the shah in Tehran.) The Kurdish rulers thought that the Ottoman government would not be as able to tax or conscript their tribes, because the Qajar government in Tehran was nearer than the Ottoman government in Constantinople. Both governments helped rebels who had fought against the other government. For the governments of both empires, controlling the Kurdish lands on the border with their armies was was not possible.