Sima Yi allowed him to pass, but Zhang He was sent to pursue and chased him for ten miles. But then there came an unexpected roll of drums. Zhang He was stopped by Wei Yan while Ma Su got past. Whirling up his sword, Wei Yan dashed toward Zhang He, who retired within his ranks and fled. Wei Yan followed and drove Zhang He backward toward Jieting.
The pursuit continued for fifteen miles, and then Wei Yan found himself in an ambush, Sima Yi on one side and Sima Zhao on the other. They went around the hill and closed in behind Wei Yan, and he was surrounded. Zhang He then turned back, and the attack was now on three sides. Wei Yan lost many troops, and all his efforts failed to get him clear of the press. Then help appeared in the person of Wang Ping.
“This is life for me,” said Wei Yan as he saw Wang Ping coming up, and the two forces joined in a new attack on the force of Wei. So the troops of Wei drew off, while Wei Yan and Wang Ping made all haste back to their own camps — only to find them in the hands of the enemy.
Shen Yi and Shen Dan then rushed out and drove Wei Yan and Wang Ping to Liliu. There they were received by Gao Xiang who had come out to meet his unfortunate colleagues.
When Gao Xiang heard their story, he at once proposed a night attack on the Wei camp and the recovery of Jieting. They talked this over on the hillside and arranged their plans, after which they set themselves to wait till it was dark enough to start.
They set out along three roads; and Wei Yan was the first to reach Jieting. Not a soldier was visible, which looked suspicious. He decided to await the arrival of Gao Xiang, and they both speculated as to the whereabouts of their enemy. They could find no trace, and the third army under Wang Ping had not yet come up.
Suddenly a bomb exploded, and a brilliant flash lit up the sky; drums rolled as though the earth was rending, and the enemy appeared. In a trice the armies of Shu found themselves hemmed in. Both Wei Yan and Gao Xiang pushed here and shoved there, but could find no way out. Then most opportunely from behind a hill rolled out a thunder of drums, and there was Wang Ping coming to their rescue. Then the three forced their way to Liliu. But just as they drew near to the rampart, another body of soldiers came up, which, from the writing on their flags, they read “Wei Commander Guo Huai”.
Now Guo Huai had talked over Sima Yi's recall with his colleague Cao Zhen, and, fearing lest the recalled general should acquire too great glory, Guo Huai had set out to anticipate him in the capture of Jieting. Disappointed when he heard of Sima Yi's success there, he had decided to try a similar exploit at Liliu. So he had diverted his march thither.
He engaged the three Shu armies at once and slew so many of them that at Wei Yan's suggestion they all left for Yangping Pass, which might be in danger.
Guo Huai, pleased with his success, gathered in his army after the victory and said to his officers, “I was disappointed at Jieting, but we have taken this place, and that is merit of high order.”
Thereupon he proceeded to the city gates. Just as he arrived, a bomb exploded on the wall, and, looking up, he saw the rampart bedecked with flags. On the largest banner he read the characters “Sima Yi, General Who Pacifies the West”. At that moment Sima Yi himself lifted a board that hung in front of him and looked over the breast-high rail.
He looked down and smiled, saying, “How late you are, friend Guo Huai!”
Guo Huai was amazed. “He is too much for me,” said he.
So Guo Huai resignedly entered the city and went to pay his respects to his successful rival.
Sima Yi was gracious, and said, “Zhuge Liang must retire now that Jieting is lost. You join forces with Cao Zhen and follow up quickly.”
Guo Huai agreed and took his leave.
Sima Yi called to him Zhang He, and said, “Cao Zhen and Guo Huai thought we should win too great merit, so they tried to get ahead of us here. We are not the only ones who desire to achieve good service and acquire merit, but we had the good fortune to succeed. I thought Wei Yan, Ma Su, Wang Ping, and Gao Xiang would first try to occupy Yangping Pass; and if I went to take it, then Zhuge Liang would fall on our rear. It says in the books on war that one should crush a retreating enemy, not pursue broken rebels; so you may go along the by-roads and smite those withdrawing down the Chi Valley, while I oppose the Xie Valley army. If they flee, do not press them too much, but just hold them up on the road and capture the baggage train.”
Zhang He marched away with half the force to carry out his part of this plan, while Sima Yi gave orders to go to the Xie Valley by way of Xicheng, which though a small place, was important as a depot of stores for the Shu army, beside commanding the road to the three counties of Nanan, Tianshui, and Anding. If this place could be captured, the other three could be recaptured.