The Great Wall built by Qin dynasty was built originally to defend Xiongnu. ... But because of the military geniuses Wei Qing and Huo Qubing, who win several wars against Xiongnu changed this situation, Xiongnu wasn't able to invade China any more. After the Xiongnu civil war, it was divided into two part.