People's Republic of China
The word "county" is used to translate the Chinese term xiàn (县 or 縣). In Mainland China, governed by the People's Republic of China (PRC), counties are the third level of local government, coming under both the province level and the prefecture level.
There are 1,464 counties in the PRC out of 2,862 county-level divisions. The number of counties has remained more or less constant since the Han dynasty (206 BC–AD 220). The county remains one of the oldest levels of government in China and significantly predates the establishment of provinces in the Yuan dynasty (1279–1368). The county government was particularly important in imperial China because this was the lowest layer at which the imperial government functioned. The head of a county during imperial times was the magistrate.
In older context, "district" was an older English translation of xiàn before the establishment of the Republic of China (ROC). The English nomenclature "county" was adopted following the establishment of the ROC.
During most of the imperial times, there were no concepts like municipalities in China. All cities existed within counties, commanderies, prefectures, etc., and had no governments of their own. Large cities (must be imperial capitals or seats of prefectures) could be divided and administered by two or three counties. Such counties are called 倚郭縣 yǐguō xiàn ("county leaning on the city walls"), or 附郭縣 fùguō xiàn ("county attached to the city walls"). The yamen or governmental houses of these counties exist in the same city. In other words, they share one county town. In this sense, a yǐguō xiàn or fùguō xiàn is similar to a district of a city.
For example, the city of Guangzhou (seat of the eponymous prefecture, also known as Canton in the Western world) was historically divided by Nanhai County (南海縣) and Panyu County (番禺縣). When the first modern city government in China was established in Guangzhou, the urban area was separated from these two counties, with the rural areas left in the remaining parts of them. However, the county governments remained in the city for years, before moving into the respective counties. Similar processes happened in many Chinese cities.
Nowadays, most counties in mainland China are administered by prefecture-level cities. However, they are all rural areas, and no longer serve as urban districts.