[1] The city wall, which survived until the 20th century and parts of which remain to this day, was, however, built in 1554 during the Ming dynasty, in order to protect the town from raids by Japanese pirates.
[2] In addition to the local garrison, the city was surrounded by Qing army posts at Jiangning (Nanjing), Jingkou (Zhenjiang), Hangzhou, and Zhapu.
In 1909, three new gates were pierced: The Old City walls were dismantled in 1912 by General Chen Qimei, the new Governor of Shanghai.
The Old City remained under Chinese control, while the foreign concessions to its north and west quickly developed into the new urban areas of Shanghai.
The Governor of Shanghai Wu Jianzhang fled to the British Concession and had to transfer control of trade to the foreigners in exchange for help in retaking the city.
The Old City of Shanghai stands on the site of a relatively small settlement in ancient times, which began to develop in importance in the 12th and 13th century due to the siltration of waterways further upstream, causing dock and market activities to move from larger upstream towns to this location.
In 1267, in the Song dynasty, Shanghai was raised to township status, with a military garrison, within Huating County.
In 1277, Shanghai township was chosen as the location of one of seven customs authorities across the empire to handle overseas trade; the surrounding Huating County was raised to prefecture level.
In 1937, the collaborationist puppet government under Japanese occupation renamed the district "Nanshi" (literally the "southern city").
Today the Old City contains some ancient but renovated features, such as the Yuyuan Garden complex first created in the 1500s during the Ming dynasty,[7] the pedestrian streets of the commercial area around the garden and the City God Temple[8] (materials for tourists often refer to it as the Nanshi District although the area is now in the Huangpu District).
[1] The Old City is a combination of ancient winding streets, with some modern high-rise buildings progressively encroaching on the older areas.
[1] In 2006, the Shanghai municipal government enacted the Protection Plan for the Old City Historical Cultural Scenery Area.