In ancient China, civil servants were scholars who belonged to the most powerful and prestigious social class. Initially local officials determined who could become civil servants, but during the Han dynasty the testing of candidates was implemented. During the Song dynasty, the imperial examination system was greatly expanded, and achievement on the exams became the primary criteria for determining placement as a civil servant.