The history of education, like other history, extends at least as far back as the first written records recovered from ancient civilizations. Historical studies have included virtually every nation.[1][2][3] The earliest known formal school was developed in Egypt's Middle Kingdom under the direction of Kheti, treasurer to Mentuhotep II (2061-2010 BC). In ancient India, education was mainly imparted through the Vedic and Buddhist education system, while the first education system in ancient China was created in Xia dynasty (2076–1600 BC). In the city-states of ancient Greece, most education was private, except in Sparta. For example, in Athens, during the 5th and 4th century BC, aside from two years military training, the state played little part in schooling. The first schools in Ancient Rome arose by the middle of the 4th century BC.
In Europe, during the Early Middle Ages, the monasteries of the Roman Catholic Church were the centers of education and literacy, preserving the Church's selection from Latin learning and maintaining the art of writing. In the Islamic civilization that spread all the way between China and Spain during the time between the 7th and 19th centuries, Muslims started schooling from 622 in Medina, which is now a city in Saudi Arabia, schooling at first was in the mosques (masjid in Arabic) but then schools became separate in schools next to mosques. Modern systems of education in Europe derive their origins from the schools of the High Middle Ages. Most schools during this era were founded upon religious principles with the primary purpose of training the clergy. Many of the earliest universities, such as the University of Paris founded in 1160, had a Christian basis. In addition to this, a number of secular universities existed, such as the University of Bologna, founded in 1088, the oldest university in continuous operation in the world, and the University of Naples Federico II (founded in 1224) in Italy, the world's oldest state-funded university in continuous operation.
In northern Europe this clerical education was largely superseded by forms of elementary schooling following the Reformation. Herbart developed a system of pedagogy widely used in German-speaking areas. Mass compulsory schooling started in Prussia by around 1800 to "produce more soldiers and more obedient citizens". After 1868 reformers set Japan on a rapid course of modernization, with a public education system like that of Western Europe. In Imperial Russia, according to the 1897 census, literate people made up 28 per cent of the population. There was a strong network of universities for the upper class, but weaker provisions for everyone else. Vladimir Lenin, in 1919 proclaimed the major aim of the Soviet government was the abolition of illiteracy. A system of universal compulsory education was established. Millions of illiterate adults were enrolled in special literacy schools.