The office of prefectural judge (tuiguan 推官) was created by the Tang dynasty 唐 (618-907) as a senior post in the administrative jurisdictions of military commissioners (jiedushi 節度使), surveillance commissioners (guanchashi 觀察使), military training commissioners (tuanlianshi 團練使), defence commissioners (fangyushi 防御使), and investigation commissioners (caifangshi 采訪處). Prefectural judges were responsible for criminal investigation, interrogation and dispensing justice. They served as aides to the commissioners, vice commissioners (fushi 副使) and the administrative assistants to the commissioners (panguan 判官).
The Five Dynasties 五代 (907-960) and the Song 宋 (960-1279) inherited the office, yet the Song dynasty put it under the jurisdiction of the State Finance Commission (sansi 三司), with the function of administrative assistant, but also responsible for all judicial cases. In the metropolitan prefecture of Kaifeng 開封府 (today in Henan), two judges were appointed in the left, and right bureaus of judicial review (zuo-youting tuiguan 左右廳推官). The two rotated according to the calendar and the number and nature of cases. After moving to the southeast, the Song changed the system somewhat and appointed to judges – then called *commissionary judge (jiedu tuiguan 節度推官), and *surveillance judge (guancha tuiguan 觀察推官) - not just in the metropolitan prefecture of Lin'an 臨安府 (today's Hangzhou 杭州, Zhejiang), but in all prefectures of the Southern Song empire 南宋 (1127-1279). In smaller and less populous prefectures, simple judges were appointed, or no one at all, while judicial matters were taken over by the administrative assistants (panguan) of the prefectural commissioners or the commissioner's agent (zhishi 支使).
The Jurchen Jin dynasty 金 (1115-1234) made this office for the first time a genuinely local one to be found in all prefectures (fu 府), but also in the resident regent's offices (liushousi 留守司) in the multiple capitals, and the *route supervisorates (lu zongguanfu 路總管府). The post was endowed with the official rank 6B or 7A., depending on the size of the prefecture. The prefectural judges cooperated with the administrative assistants of the capitals (fupan 府判) to share responsibilities for judicial matters and issues of public work and military affairs.
This system was copied by the Yuan dynasty 元 (1279-1368), but the responsibilities of the tuiguan reduced to that of judges. In the capital Dadu 大都 (present-day Beijing), there were two supreme supervisors-in-chief (du zongguanfu 都總管府), who cooperated with daruγačis (Ch. daluhuachi 達魯花赤) to administer their jurisdictional area. In the normal prefectures, the tuiguan were aides (zuoguan 佐官) to the prefectural administration.
The Ming dynasty 明 (1368-1644) first called the function zhifu zuo'erguan 知府佐貳官, making the prefectural judges assistants to the prefects (zhifu 知府), but in 1370 took over the Yuan system for all prefectures and the two metropolitan prefectures Shuntian 順天 (Beijing), and Yingtian 應天 (Nanjing). They were responsible for justice and for the evaluation of state officials (jidian 計典). In the very early years, the Qing dynasty 清 (1644-1911) knew not just the office of prefectural judge, but also that of nominal or vice judge (guaxian tuiguan 掛銜推官, also written 絓銜推官). The latter was abolished in 1646, and the office of prefectural judge was eliminated in 1667. From then on, jurisdictional matters fell into the portfolio of district magistrates (zhixian 知縣) and prefects.