Before the , Ma Teng controlled a sizable army in the northwestern frontiers of China which threatened the North China Plains controlled by Cao Cao. When Cao Cao finished his in 207, he wished to turn south to invade Liu Bei and Sun Quan; so to avoid being attacked from behind, Cao Cao made Ma Teng an imperial officer and summoned him to , which Cao controlled. Ma Teng's household was effectively a hostage to prevent Ma Teng's son, Ma Chao, from attacking.
Cao Cao's southern expedition did not go well; however, as he was defeated by the combined forces of Sun Quan and Liu Bei at the Battle of Red Cliffs in 208. He soon turned his attention west instead, with the intention to invade Guanzhong. In March 211, Cao Cao sent Zhong Yao to attack Hanzhong, controlled by warlord Zhang Lu, while sending Xiahou Yuan to rendezvous with Zhong Yao's forces. Gao Rou cautioned Cao Cao against such a move, saying that sending massive armies west could draw suspicion from the forces of Guanxi and cause them to revolt. However, Cao Cao paid no heed to his cautions.
As predicted, the forces of Guanxi began suspecting an assault from Cao Cao, and soon Ma Chao, Han Sui, Hou Xuan, Cheng Yin, Yang Qiu, Li Kan, , Liang Xing, , and collected their strengths and marched into Tong Pass. Their army consisted of a mixture of Han Chinese, Qiang, and soldiers. Many counties of the area joined the uprising, and the civilians had to escape into Hanzhong by the way of the Ziwu Valley .
In response, Cao Cao had Cao Ren defend against the invading forces and issued orders that they must refrain from engaging the enemy.
In July, Cao Cao himself left the capital to lead his troops against Ma Chao, while leaving his son Cao Pi to defend his headquarters in . In August, his troops arrived at Tong Pass where the standoff between his forces and the Guanxi forces was taking place. As the standoff dragged on, more and more Guanxi reinforcements came to Tong Pass, but Cao Cao seemed gleeful at every instance of enemy reinforcements. When asked by his officers why he was so happy when the enemy was gaining numbers, he replied "The road to Guanzhong is long, and if the barbarians defended themselves along the treacherous terrain, we cannot conquer them in one or two years. But now that they all assembled here in this uneasy alliance, it will be much easier to extinguish them. That is why I am happy."
Cao Cao gave the Guanxi forces an impression that a frontal assault was imminent, but on the other hand, he sent Xu Huang and to travel north and cross the Yellow River via the Puban Crossing to the west with four thousand men and pitch camp there, in order to circumvent Tong Pass. A month later, Cao Cao's main force followed, while Cao Cao and Xu Chu guarded the rear. When Ma Chao got word of Cao Cao's manoeuvrer, he led roughly ten thousand men to give chase. Arrows poured down on the rearguard, but Cao Cao was in no hurry. Seeing that the situation became dire, Xu Chu helped Cao Cao onto a boat, but the ferryman was shot dead. Xu Shu then used a saddle to shield arrows with his left hand, and paddled the boat with his right. Ma Chao's men kept on firing arrows on Cao Cao's boat even though it had sailed for miles. It was then Ding Fei , a general under Cao Cao, gave the command to release the livestock. Seeing this, the pursuing army, being mostly herders, gave up on the chase and went for the horses and oxen instead. It was through these efforts that Cao Cao safely crossed the river.
Cao Cao's force then regrouped with Xu Huang's, and marched south along the river. The Guanxi armies then moved their defenses accordingly along the river. Cao Cao prepared decoy troops to distract the defenses while setting up a pontoon bridge that would allow his forces to complete the circumvention of Tong Pass. At night, a portion of Cao Cao's forces crossed the river and set camp there. It was shortly attacked by Ma Chao, but he was repelled by Cao Cao's ambushes.
As the battle dragged on, Ma Chao attempted a ceasefire where he requested the lands west of Wei River, but Cao Cao rejected. Ma Chao would try to engage Cao Cao's men at his newly established camp, but Cao Cao defended well and would not bite the bait. In an attempt to negotiate, Cao Cao, Han Sui, and Ma Chao came together bringing no one but their close guards. Ma Chao had hoped that, with his strength, he could capture Cao Cao and force him to agree to their terms, but he had heard of the prowess of Cao Cao's bodyguard, so he asked, "is the Tiger Marquis with you today?" Cao Cao pointed at Xu Chu who glared at Ma Chao, and Ma Chao dared not make a move.
To avoid attrition, the generals of the Guanxi armies agreed to cede territories and send their sons to Cao Cao as hostages in exchange for peace. Cao Cao's strategist Jia Xu suggested that he could pretend to accept the terms, and then turn the allied forces against each other. Cao Cao agreed, and arranged for an armistice. Han Sui was sent by the Guanxi armies as the representative. He was once a friend of Cao Cao, and when they met, they did not talk about military affairs but instead recollected their youths in the capital, occasionally clapping their hands and laughing amiably. When the meeting was over, Ma Chao demanded to know what Cao Cao said, but Han Sui responded that it was nothing much. Ma Chao became suspicious of Han Sui from there on. A few days later, Cao Cao sent Han Sui a letter with certain words smudged out as if Han Sui did it himself. Ma Chao saw this letter and thought Han Sui was collaborating with Cao Cao, and did not trust Han Sui any more.
To capitalize on this suspicion, Cao Cao set the time for a final clash between the two forces. First, he challenged the allied forces with lightly armoured soldiers, then surrounding the allied forces with heavy cavalry in both flanks. The allies were routed and many of their commanders were killed in battle. Han Sui and Ma Chao fled to Liangzhou and Yang Qiu to Anding . Cao Cao emerged victorious.
The forces of Guanxi were unable to collect again in a coalition and their strengths were greatly weakened after this battle. Of the remnants of the coalition, Yang Qiu soon surrendered, Han Sui was defeated by Xu Huang and Zhang He, and only Ma Chao was actively causing trouble for Cao Cao.
After Cao Cao's main army retreated due to an uprising back home, Ma Chao attacked the prefectures of Longxi with the forces of the western tribes and the prefectures took their lead from him, except for the city of Jicheng . When he Jicheng, Ma Chao killed the Inspector of Liangzhou, Wei Kang , occupied the city and controlled Wei Kang’s forces. He called himself the General Who Conquers the West and took over the governance of Bingzhou and the military matters of Liangzhou. The deputies who served under Wei Kang, Yang Fu, Jiang Xu , Liang Kuan , Zhao Qu and others plotted against Ma Chao. Yang Fu and Jiang Xu in Licheng and Ma Chao left Jicheng to quell the uprising, but he was not successful. Meanwhile, Liang Kuan and Zhao Qu closed the gates to Jicheng and Ma Chao could not return to the city. He had little choice but to seek refuge with Zhang Lu in Hanzhong.
Later, Cao Cao had Ma Teng's household executed for Ma Chao's uprising. Only Ma Chao and his cousin Ma Dai remained in his once great family.
In ''Romance of the Three Kingdoms''
In the novel ''Romance of the Three Kingdoms'', Chapters 58 and 59 are dedicated to this battle.
Cao had lured Ma Teng into the capital and had him killed because Ma Teng had plotted to assassinate Cao. To avenge for his father's death, Ma Chao led a coalition of dissidents against Cao Cao. Together with Han Sui, Ma Chao set off for Chang'an and conquered it easily. Having conquered Chang'an they advanced towards Tong Pass. Cao Cao then immediately dispatched Cao Hong and Xu Huang with 10,000 troops to Tong Pass to defend the pass with specific orders not to engage the enemy for ten days.
On the ninth day Cao Hong could no longer put up with the insults and taunts shouted by Ma Chao and his army and therefore led a contingent of troops out of the pass to fight Ma Chao's forces without permission. Xu Huang came out to help Cao Hong but the two of them were no match for Ma Chao who successfully took the pass. Cao Cao led troops personally to recapture Tong Pass but failed when Ma Chao defeated many of Cao Cao's top generals such as Yu Jin and Zhang He. Ma Chao then directly attacked Cao Cao. Cao Cao, in a bid to escape, cut off his beard and threw away his robe to avoid being identified by Ma Chao's troops before being rescued by Cao Hong and Xiahou Yuan.
In order to cut off Ma Chao's supplies lines, Cao Cao led troops to cross the river but Ma Chao was prepared and ambushed him instead. Xu Chu, Cao Cao's bodyguard, protected Cao, who would have otherwise perished there. Later Ma Chao was challenged to a duel by Xu Chu. The duel was a draw but the subsequent battle forced Cao Cao to retreat. In the days ahead, Ma Chao harassed Cao Cao's troops and gave them no chance of setting up camps. Cao Cao established a camp anyway, in a short amount of time, using the cold weather and the river water to construct an ice fortress. Knowing that it would be very difficult to defeat a valiant general like Ma Chao, Cao Cao accepted his adviser Jia Xu's proposal to pretend to make peace with Ma Chao and at the same time attempt to turn Ma Chao and Han Sui against each other. Slowly the two men were driven apart. Ma Chao thought that Han Sui had collaborated with Cao Cao against him and tried to kill Han Sui, but only managed to chop off Han Sui's hand. In the ensuing confusion, Cao Cao launched an attack on his confused enemies and overcame them.
In popular culture
The Battle of Tong Gate is one of the playable stages in the ''Dynasty Warriors'' series for the Playstation 2. If the player is on the Wei side and follows history and novel by making Han Sui defect, it is an easy victory.