A mandarin (Chinese: 官; pinyin: guān; Cantonese Yale: gun1; Vietnamese: quan) was a bureaucrat in imperial China, and also in the monarchist days of Vietnam where the system of Imperial examinations and scholar-bureaucrats was adopted under Chinese influence
History and use of the term 
The English term comes from the Portuguese mandarim (early spelling, mandarin). The Portuguese word is amply attested already in one of the earliest Portuguese reports about China: letters from the imprisoned survivors of the Tomé Pires' embassy, which were most likely written in 1524, and in Castanheda's História do descobrimento e conquista da Índia pelos portugueses. Its usage among the Portuguese is also attested by Matteo Ricci, who entered the mainland China from the Portuguese Macau in the late 16th century.
The Portuguese word was thought by many to be related to mandador ("one who commands") and mandar ("to command"), from Latin "mandare". Modern dictionaries, however, agree that it was in fact borrowed by Portuguese from the Malay [ˈməntəri], which ultimately came from the Sanskrit mantrin (Devanagari: मंत्री) (meaning counselor or minister – etymologically linked to "Mantra"). According to Malaysian Royal Professor Ungku Abdul Aziz, the term had its origin when the Portuguese living in Malacca during the Malacca Sultanate wanted to meet with the higher officials in China, and used the term "menteri", but with an added "n" due to their poor grasp of the language, to refer to higher officials.
In the 16th century, before the term mandarin became widespread in the European languages, the word Loutea (with various spelling variations) was often used in Europeans' travel reports to refer to Chinese scholar-officials. It is frequently used e.g. in Galeote Pereira's account of his experiences in China in 1548–1553, which was published in Europe in 1565, or (as Louthia) in Gaspar da Cruz' Treatise of China (1569). As C.R. Boxer explains, the word comes from the Chinese 老爷 (Mandarin Pinyin: lǎoye; Amoy dialect: ló-tia; Quanzhou dialect: lāu-tia), which was commonly used by people in China to address officials. This is also the main term used to refer to the scholar-officials in Juan González de Mendoza's History of the great and mighty kingdom of China and the situation thereof (1585), which heavily drew (directly or indirectly) on Pereira's report and Gaspar da Cruz' book, and which was the Europeans' standard reference on China in the late 16th century.
In the West, the term mandarin is associated with the concept of the scholar-official, who immersed himself in poetry, literature, and Confucian learning in addition to performing civil service duties.
The term "Mandarin" is also used to refer to the standard northern spoken variety of Chinese because it was the language used among officials during the Ming and Qing dynasties. It can be thought as the translation of the Chinese name Guanhua ("the language of the officials") for this speech standard, which was current already in the Ming Dynasty.
For around 1300 years, from 605 to 1905, mandarins were selected by merit through the extremely rigorous imperial examination.
China has had civil servants since at least the Zhou Dynasty. However most high ranking positions were filled by relatives of the sovereign and the nobility. It was not until the Tang Dynasty when the final form of the mandarin was completed with the replacement of the nine-rank system. The mandarins were the founders and core of the Chinese gentry. The mandarins were replaced with a modern civil service after the fall of the Qing Dynasty.
Vietnam, after becoming free of Chinese rule and setting up its own independent monarchy, emulated the Chinese system of mandarins in its civil service.
Social hierarchy of mandarins 
During the Qing dynasty, the highest rank a mandarin could achieve in the mandarin social hierarchy, the governor of a Chinese province, was signified by wearing a mandarin hat-pin made of ruby. The lower ranks of mandarins were signified by hat-pins made of coral, sapphire, lapis lazuli, white jade, gold, and silver. 
Figurative meaning 
See also 
- Mandarin square, for mandarins' ranks and badges of distinction
- Imperial examination
- Title Letters from Portuguese captives in Canton, written in 1534 & 1536: with an introduction on Portuguese intercourse with China in the first half of the sixteenth century. Educ. Steam Press, Byculla. 1902.. The letters were not published at the time, but apparently distributed in manuscript form; Ferguson published the copy found in a Paris library. While Ferguson accepted the 1534 and 1536 dates given in the Paris manuscripts, later researchers concluded that in reality the letters were sent in 1524 (Boxer et al. 1953, p. xxi). In the letters the word occurs numerous times in its plural form, both with a final n/m: mandarĩs, manderĩs, manderỹs and without it: mandaris, manderys, mandarys. (Note that in the 16th-century Portuguese orthography, one would often put a tilde over a final vowel instead of writing an n or m after the vowel; thus ĩ or ỹ would be transcribed as in/im or yn/ym in most modern reprints.)
- Fernão Lopes de Castanheda, História do descobrimento e conquista da Índia pelos portugueses, Vol. VI, cap II, 26. Castanheda's spelling (in plural) is still mandarins.
- Matteo Ricci, De Christiana expeditione apud Sinas. Page 45 in the English translation, "China in the Sixteenth Century: The Journals of Matteo Ricci", Random House, New York, 1953. In the original Latin, vol. 1, p. 51: "Lusitani Magistratus illos, à mandando fortasse, Mandarinos vocant, quo nomine iam etiam apud Europæos Sinici Magistratus intelliguntur".
- Johnson, Samuel (1827). Dictionnary of the english language. Lyon Public Library: Longman.
- Mandarin, Online Etymology Dictionary
- Mandarin Merriam-Webster
- "mandarin", Shorter Oxford English Dictionary 1 (6th ed.). Oxford University Press. 2007. ISBN 978-0-19-920687-2.
- Ku Seman Ku Hussain; Hafizahril Abdul Hamid (19 July 2009). "PPSMI satu kesilapan" [PPSMI a mistake]. Mingguan Malaysia (in Malay) (Kuala Lumpur: Utusan Melayu (M) Berhad). p. 7. "Jadi perkataan menteri itu disebut kepada "menterin" dan apabila mereka pergi ke negeri China untuk berjumpa dengan pegawai tinggi akhirnya perkataan "menterin" tadi bertukar kepada "Mandarin"."
- Boxer, Charles Ralph; Pereira, Galeote; Cruz, Gaspar da; de Rada, Martín (1953), South China in the sixteenth century: being the narratives of Galeote Pereira, Fr. Gaspar da Cruz, O.P. [and] Fr. Martín de Rada, O.E.S.A. (1550–1575), Issue 106 of Works issued by the Hakluyt Society, Printed for the Hakluyt Society, p. 10 sq.. Minnan (Amoy and Quanzhou) pronunciation is given as per C.R. Boxer, whose source is Carstairs Douglas's Dictionary of the Amoy vernacular.
- "LOUTEA, LOYTIA, &c" in: Yule, Sir Henry; Burnell, Arthur Coke (1903), in Crooke, William, [[Hobson-Jobson|Hobson-Jobson: a glossary of colloquial Anglo-Indian words and phrases, and of kindred terms, etymological, historical, geographical and discursive]], J. Murray, pp. 522–523 Wikilink embedded in URL title (help)
- Guanhua is transcribed by Matteo Ricci and other early European writers as Quonhua, in accordance with Ricci's transcription system that remained in use by Jesuits for a long time after his death. See pages 28–29 in the English translation, China in the Sixteenth Century: The Journals of Matteo Ricci, Random House, New York, 1953. In the original Latin, De Christiana expeditione apud Sinas suscepta ab Societate Jesu (1617), vol. 1, p. 31: "Præter hunc tamen cuique Provinciæ vernaculum sermonem, alius est universo regno communis, quem ipsi Quonhua vocant, quod curialem vel forensem sonat."
- Bonavia, David Peking New York:1978 Time-Life Books Great Cities of the World series Page 157
- e.g. as in the titles of such works as The Mandarins by Simone de Beauvoir, Chomsky's American Power and the New Mandarins, etc.