As the Qi emperor force moved in to the tang pass , The Qi vanguard was the first to encounter the tang troops, fighting them and then routing them , the vanguard told then the Qi emperor of their victory against a possible trap and he continued . but Tan sent some divisions of infantry to find and dislodge the tang if they found them but after an hour of searching they didn't find anything they reported this to Tan who assumed the force was routed , with this he neglected maintaining a defensive formation or preparing his missle units, By the time the first 3 divisions crossed and the other ones were still on the pass the Tang attacked from the same entrance Cui had used against them years prior ,Tan tried to form last minute defenses but it was to late , as that division lost its cohesion and the fleeing soldiers spread their panic by running in to each other as the tang pushed them or showered them with their own missle units , in the chaos one of the Qi generals was killed .
The tang were concentrated on killing Tan while at the same time destroying the siege engines of the Qi which the latter they did with ease as many men just abandoned it as the panic spread the front finally realized what was happening but could do nothing as many began to flee pushed them to the exit , it is said at this point of the battle Tan suffered a panic attack, after rambling and attempting to flee he just stayed there accepting his fate , how ever the remanding commanders established some form of order and led part of the troops to a defensive position which managed to turn to face them as they slowly retreated back the stand off lasted nearly a quarter of an hour until they approached the exit
Half an hour after the battle commended the rearguard finally made it out as the front had already made a fortified camp just in case , the action turned out to be correct one as they spent the night fighting off attacks from the tang infantry or missle units , Du Shenyan and the book of tang both record that Tan considered abandoning the troops and fleeing back to Luoyang but his commanders disproved of it , how ever modern historians say this an exaggeration as both these sources didn't exactly paint him in a positive light, for the next days the tang would encircle the camp but be driven out in their attempts to take out and on the third day they were attacked via a cavalry charge that killed many and the battle finally was over, still 1/3 of Tans army became a casualty , while the tang lost some couple of thousands , it was a defeat the Qi in terms of military could recover but not politicly.
As soon of news of the defeat spread for many it was the final straw as it destroyed what ever prestige he had left ,rebellions broke off in the south and north , while the victorious tang went to take Baoji , Tan went to crush the rebellion in Taiyuan here the general and Tan fought near Luzhou were Tan was defeated and he was forced to flee south as the tang took Baoji and moved to take the western capital , by the end of the year the situation seemed like it was to collapse in the north the rebellious generals was de facto independent , while to the east they pushed as far as Hangzhou , as the in the other parts of the south they took Jiangling and Ezhou, as the tang were laying siege to the western capital.
These collapse of the Qi also led to a total collapse of the economy finally in November 835 he was deposed and killed and put one of his sons as emperor , by 836 while in the north the rebels invited the nomads against the Qi , while in the south the generals ignoring the new emperor as they became defacto leaders and began to fight with each other for supremacy as the tang advanced and in some cases some of these sided with them , by may 836 Chang'an had fallen to the tang forces in panic the new emperor sent what forces he had to stop them in the tong pass but this force was ambushed utterly defeated by the tang , the way to Luoyang now stood open , this defeat ensured the end of the Qi dynasty as modern historians says it was the last chance tried to stop the tang and influence both fronts with their defeat the conquest of the Qi was now inventible.
When news came the new emperor abandoned Luoyang to Taiyuan were they accepted him as the tang forces laid siege to the city just a couple of weeks later , while in the north the rebellion spread and they moved to take Dingzhou here the governor of Taiyuan moved to fight him and won the battle after the nomads betrayed the rebel abandoning him during the battle, despite this victory, he had to deal with the numbers of refugees that were fleeing the north and were now in his territory, some were accepted others not there was not enough recourses for all of them , some left peacefully while other revolted, if there was no sanctuary there was force.
as the tang kept pushing as by the coast the push to the Yangtzer river was a bloody one as both tang and rebel soldiers mascaraed people for fear that they were siding with the other or simply to steal supplies from them , forcing many more to flee , while the Tang took Xianyang moving to the north , then by July the order to evacuation of Luoyang taking as many weapons and gold with them while some others are hidden plans are made to return and take them back but no one will return , while the warlords send word for help but will not receive any, the chaos makes economy and the trade crash , by autumn the grain stores are burned or looted by many sides, the great canal was damaged spreading famine and disease sweeps the most affected areas finally in December 836 the governor of Taiyuan was defeated by the tang emperor near Luzhou .
After 9 years, one month and two days the red turban rebellion of the Qi dynasty was finally snuffed out.