From the moment he launched his campaign for president, Donald Trump compared the barrier he wanted to build along the U.S. southern border to China's Great Wall. With the U.S. government now shuttered by the standoff over funding Trump's wall, both he and his Democratic opponents might want to take a closer look at the Chinese fortification — and why exactly it failed.

The Great Wall visited by tourists today is the handiwork of the Ming Dynasty (1368-1644) and was primarily constructed in the mid-to-late 16th century. The common perception is that the wall was conceived as a single, massive infrastructure project to protect China's tumultuous northern border from foreign invaders. It was nothing of the sort. The Great Wall was built to a great degree by default, by a political system too paralyzed by infighting to come up with anything better.

Border security had been a preoccupation of China's imperial court from its earliest days. "Barbarians" from the northern steppe — whether Xiongnu, Turk, Jurchen, Mongol or other — routinely threatened the Middle Kingdom. Some, such as Genghis Khan's Mongols in the 13th century, managed to overrun the entire empire.