Beginning with the second decade of the 19th century the Jewish population of Moscow began to increase. From the year 1827, during the reign of Nicholas I, the Jews were compelled to serve for 25 years in the army. Many such Jewish soldiers were sent to Moscow." Most of the first Jews to settle in Moscow were these cantonists, Jews that had been conscripted to the army as children, and were now done with their military service. Some of them had married Jewish women from the Pale of Settlement, where the vast majority of Jews were stricted to living. In 1858, the Jewish population in the District of Moscow was 340 men and 104 women. During the rule of Tsar Alexander II, Jews who met certain criteria were allowed to live in the city. These were: Jews who had university degrees, completed military service, or were pharmacists, dentists, midwives, or first-guild merchants. As the Jewish population increased, many Jews who came did not fit the criteria and were illegal and unregistered. Liberal city administrators at the time largely looked the other way. In 1871, the Jewish population was about 8,000. In this time, the foundations of the community were laid, including the creation of the first Jewish cemetery in 1860s and the opening of a Jewish school and first formal synagogue in 1871.