Ming Dynasty
The Ming dynasty imposed tight trade restrictions in the 16th century to guard against the Wokou. Because of those restrictions all foreign trade came to an end. After a hundred merchants died when Shanghai was pillaged by pirates, the Ming government evacuated the entire coastal population to the interior. In 1554, a wall was built to protect the city from future invasions.
Read more about this topic: History Of Shanghai