The county magistrate or local magistrate, known by several Chinese names, was the official in charge of the xian ("county"), the lowest level of central government in Imperial and early Republican China. The magistrate was the official who had face-to-face relations with the people and administered all aspects of government on behalf of the emperor.
The emperor appointed magistrates from among those who passed the imperial examinations or had purchased equivalent degrees. Education in the Confucian Classics included no practical training, but indoctrinated the officials with a shared ideology which helped to unify the empire. A magistrate acquired specialized skills only after assuming office. Once in office, the magistrate was caught between the demands of his superiors and the needs and the resistance of his often-unruly constituents. Promotion depended on the magistrate's ability to maintain peace and lawful order as he supervised tax collection, roads, water control, and the census; handled legal functions as both prosecutor and judge; arranged relief for the poor or the afflicted; carried out rituals; encouraged education and schools; and performed any further task that the emperor chose to assign.