Why was the Great Wall of China Built?

The Great Wall of China was built to protect China from its enemies, especially the Mongols. The Mongols were a tribal group that would regularly conduct raids into China. Despite the wall, the Mongols eventually conquered China.