The Qin fought nomadic tribes to the north and north-west. The Xiongnu tribes were not defeated and subdued, thus the campaign was tiring and unsuccessful, and to prevent the Xiongnu from encroaching on the northern frontier any longer, the emperor ordered the construction of an immense defensive wall. This wall, for whose construction hundreds of thousands of men were mobilized, and an unknown number died, is a precursor to the current Great Wall of China. It connected numerous state walls which had been built during the previous four centuries, a network of small walls linking river defences to impassable cliffs.