Pingyao has been a county since the Qin dynasty(221BC—207BC), and Pingyao Ancient County Government Office is the largest and best-preserved existing ancient county government office in China.

Pingyao Ancient Government office actually is a large complex which houses the home and offices of the magistrate. The magistrate was commissioned by the imperial court, to work as the mayor, judge, and senior official. The whole building complex was built in 1346, during the Yuan Dynasty (1271—1368), but only one building remains from the Yuan period, the rest were rebuilt during the Ming Dynasty (1368—1644).

The main building is the primary court for magistrates to handle official affairs or criminal cases. The secondary court is connected with the inner rooms. It is where the magistrate dealt with the civil cases, the daily works, called in subordinates, met guests. It is not as solemn as the primary court.