This position (the feudal equivalent of a Secret service agent, i.e. responsible for palace security) was established in the Qin Dynasty. Later, in the Han Dynasty, 中郎 were assigned to one of five different squads (官). Each one of these squads had its own leader, which was called 中郎將 (commander of the palace guards).