Northern Raiders and Southern Pirates
Also called: Beilu nanwo, Gengxu Incident, Jiajing wokou raids
In the mid-sixteenth century the Ming suffered at once from Mongol raids under Altan Khan in the north and from wokou pirates mixed with smugglers along the southern coast. Only around 1570, by lifting the sea ban and making peace with the Mongols, did it gain some relief.

Henry Charles Seppings Wright · Public domain · Source
The Ming rebuilt the Great Wall to hold off the Mongols in the north and enforced a sea ban against private overseas trade. Under the Jiajing Emperor in the mid-sixteenth century both threats grew at once — the crisis known as “northern raiders and southern pirates” (beilu nanwo). In the north Altan Khan of the Tümed Mongols, refused the horse markets he demanded, crossed the Wall year after year, and in 1550 plundered right up to the walls of Beijing (the Gengxu Incident).
In the south the “later wokou” — gangs of Chinese smugglers defying the sea ban, mixed with Japanese and Portuguese traders — ravaged the coasts of Zhejiang and Fujian. Most of them were Chinese, and their leader Wang Zhi was based at Hirado in Kyushu. Qi Jiguang trained volunteer troops in tactics such as the “mandarin duck formation” and crushed the pirates in the early 1560s, recording his methods in the manual Jixiao xinshu. Brought to Korea during the Imjin War, the book was used to train the “three skills” soldiers of the Military Training Command.
The Ming came to accept that defence alone would not work. Around 1567 it eased the sea ban, letting private merchants sail to Southeast Asia from Yuegang (Haicheng) in Fujian, and in 1571 it enfeoffed Altan Khan as Prince Shunyi and opened border markets (the Longqing peace). Tensions eased on both fronts, but defence spending weighed heavily on Ming finances. Joseon too suffered from Japanese pirates in these years, in the Three Ports Revolt (1510) and the Eulmyo raid (1555).