In 111 BC, the Han emperors annexed the whole Red River Delta and so began a thousand years of Chinese domination. They introduced
Confucianism
and with it a rigid, feudalistic hierarchy dominated by a mandarin class. Mahayana Buddhism first entered Vietnam from China during the second century AD.
The local aristocracy increasingly resented their Chinese rulers and engaged in various insurrections, culminating in the battle of the Bach Dang River in 938 AD, a famous victory for Ngo Quyen, leader of the Vietnamese forces, who subsequently declared himself ruler of
Nam Viet
, heralding what was to be nearly ten centuries of Vietnamese independence.