On the night of the thirteenth day of the tenth month, in the year 409, a small group of men came over the western wall of the palace at Pingcheng.
The leader was sixteen years old. His name was Tuoba Shao, and he held the title Prince of Qinghe. He landed softly. The sound of his boots on the brick was swallowed by the wind.
Inside the sleeping hall, the emperor woke. Tuoba Gui was thirty-nine. He reached for his bow. He reached for a blade. There was nothing there.
The official history gives this moment one line. The emperor looked for bow and knife, found neither, and died.
A man who had been running for his life on horseback since the age of six ended up dead inside the walls of his own house, with no weapon in his hand.
The Boy Who Lost a Kingdom
Tuoba Gui was born in 371, north of the mountains. His grandfather, Tuoba Shiyijian, was the ruler of the state of Dai.
Dai was a frontier state built by the Tuoba branch of the Xianbei. It was not large, but it was not nothing either. It held the land from the middle of modern Inner Mongolia down to the north of Shanxi. Tuoba Shiyijian had employed a Chinese adviser, Yan Feng. He had issued a legal code. He had built a new town at Shengle and copied the central plains in setting up offices. Once a grassland power starts keeping registers and collecting tax, it has stopped being a tribe.
In 376, Fu Jian of the Former Qin sent three hundred thousand soldiers north in several columns. Dai could not hold. It came apart.
Fu Jian did not wipe out the Tuoba. He cut the old territory of Dai in two, giving the land east of the Yellow River to Liu Kuren and the land west of it to Liu Weichen, two Xiongnu chiefs who would watch the pasture for him.
The boy was six years old.
For the next ten years he lived in the houses of other men. First he was taken to Liu Kuren, who treated him decently and once said that this child had ambitions that could hold the world. When Liu Kuren died, his son Liu Xian wanted the boy dead.
The mother, Lady Helan, took her son and ran in the night, back to the Helan pasture land, to her own brother He Ne.
The road was not safe. Some men in the Helan camp did not want the trouble of sheltering him. A chief named He Rangan brought soldiers to block the way and meant to kill the child. Lady Helan stood between them and spoke with such force that the men backed off.
The official history of the Northern Wei describes this period with great care and very few words. It says the child was quiet, brave, and unusually measured for his age, and that people noticed.
A child who lives on the charity of strangers learns quickly. He learns which sentence can be spoken and which will cost a life. He learns when to lower his head, and when it is safe to smile.
For the rest of his life he did one thing. He picked up what had come apart and pressed it back together.
Sixteen at Niuchuan
In the first month of 386, the chiefs gathered at Niuchuan. Tuoba Gui was sixteen. The meeting decided a simple thing. The state of Dai would be restored, and he would be its king. The reign title was declared as Dengguo.
Four months later he changed the name again. He would not be King of Dai. He would be King of Wei.
That was not a small edit. Dai was a frontier name. Wei was a name from the central plains, the name of a dynasty that had once ruled the Yellow River valley. A boy of sixteen used two characters to tell everyone what he wanted. Not a pasture. A country.
His position at that moment could hardly have been worse. Liu Xian to the south wanted him dead. The Kumo Xi raided from the east, the Rouran from the north, and Liu Weichen of the Tiefu branch carried a family feud against him. What he commanded was a collection of clans that had just been stitched together.
He chose the most practical road available. He became the nephew of Murong Chui of the Later Yan.
His mother came from the Helan clan, and the Tuoba and the Murong had married into each other for generations. That connection gave him a door to knock on. With Later Yan soldiers behind him he broke Liu Xian, then Liu Weichen, and took more than three hundred thousand fine horses and over four million head of cattle and sheep.
He campaigned north against the Gaoche and west against the Rouran, folding one pasture after another into his own following.
After each victory he did the same thing. He broke the tribes apart.
The phrase looks abstract on the page. In practice it was hard and it hurt. The old clan structure was dismantled. Households were registered and placed under direct control of the court. A chief stopped being a chief and became an official. A tribesman stopped being a tribesman and became a taxpayer.
The resistance was real. A clan chief had been the master of his own people the day before, and now he was an official drawing a salary. Some revolted. Some ran. Tuoba Gui broke the ones who revolted, chased the ones who ran, and registered the rest under the eight commands.
Then came the land. Every registered mouth was given a plot to farm. Cattle on the grassland turned into millet in a field. Men who had lived in the saddle became men who lived in a village.
Once that was done, a grassland alliance had become a state.

The Night at Canhe Slope
The Later Yan finally moved.
Tuoba Gui had grown large because Murong Chui allowed it. The old emperor had lent him soldiers to keep the western pasture quiet. By the time the Rouran, the Gaoche and the Tiefu had all been swallowed, Murong Chui saw what he had made. The dog had grown faster than the master.
In 395, Murong Chui sent his crown prince, Murong Bao, north with eighty thousand cavalry.
It was one of the few bad decisions of a long career. His older generals advised against it. The crown prince had never fought a campaign like this one. The emperor sent him anyway.
The answer of Tuoba Gui was a single word. Back.
He pulled south of the Yellow River, burned the boats, and took everything that could be carried. Murong Bao stood on the northern bank for months. Water in front, empty towns behind, supply lines cut, and not one word arriving from the capital at Zhongshan.
The Yan army was not steady either. A commander of one detached column, Muyu Song, tried to put another man on the throne. The plot was found out and he was killed. After that the officers watched each other and trusted nobody.
Then a rumour walked into the camp. Murong Chui was dead.
Tuoba Gui had started it. He had stopped the couriers of the Yan army and had men shout the news across the river, loud enough for tens of thousands to hear.
The army came apart at the seams. Murong Bao ordered a withdrawal.
In the eleventh month the Yellow River froze. Tuoba Gui took twenty thousand cavalry across the ice and followed.
He caught them at Canhe Slope. The Yan camp was pitched with its back to the water. It was still dark. The Wei horsemen came down off the ridge while the enemy was still buckling armour.
Eighty thousand men broke. Some ran, some drowned, and the rest, forty or fifty thousand of them, put down their weapons and surrendered.
What follows is the coldest line in this story. They were buried alive.
Forty or fifty thousand people, gone in a night. The history spends three characters on it. It does not describe the sound. It does not describe how the earth moved.
The figure comes from the Zizhi Tongjian. The official history of Wei is vaguer, saying only that tens of thousands were taken. The numbers do not agree. The event itself is not in dispute.
This is the heaviest debt of blood in the life of Tuoba Gui, and it is also the foundation of the Northern Wei. From that day the Later Yan never had the strength to fight him in a decisive battle again.
The next spring Murong Chui came himself, sick, carried in a cart, to take revenge. He passed Canhe Slope and saw the bones of the previous year still lying there, stacked like a hill. The soldiers with him began to weep out loud.
Murong Chui died of shame and rage on the road home.
He was seventy-one. What killed him was the defeat of his son.
With Murong Chui gone, the Later Yan lost the one man who could hold it together. Murong Bao took the throne and could not fill the space his father left.
In 396 Tuoba Gui came south with more than four hundred thousand men. He took Jinyang first, then Changshan, and before the year turned he had Zhongshan. The city of Ye surrendered soon after.
North of the Yellow River, three years changed the owner.
From Niuchuan to Zhongshan had taken a decade.
Emperor at Pingcheng
In 398 Tuoba Gui moved his capital to Pingcheng, which is modern Datong. In the twelfth month of the same year he took the title of emperor and declared a new reign era.
The move was about more than a house. South of Pingcheng lay the Yanmen pass. East lay the Taihang mountains. West lay the great bend of the Yellow River. North lay open pasture. By putting his court there he placed himself in the doorway between the grassland and the plains.
The palace wall was new, rammed earth packed thick. Outside it the fields of the royal domain were divided among the resettled clans, and beyond those lay the pasture and plough land of the eight tribal commands. Ancestral temples stood at the south of the town. The horse stables stayed at the north.
Half walled city, half tent camp.
A clan leader from Niuchuan had become a Chinese-style sovereign. He began to do things that a horseman would not normally bother with. He established a bureaucracy. He issued a legal code. He founded schools. He fixed the rites of sacrifice to heaven. He settled his people on farmland and told officials to promote agriculture.
The men who helped him were Chinese scholars, Cui Hong and Zhang Gun among them. Offices were built along the lines of the central plains. Edicts were written in the forms of the central plains. Even the ceremony in which the emperor sacrificed to heaven followed old Chinese models.
He also did something else, something much harder. He made a rule that when a son was named heir, the mother was to be put to death.
The reasoning was straightforward and it was borrowed. When Emperor Wu of the Han made his young son heir, he had the mother of the boy killed, so that her family could never rule through the child. Tuoba Gui copied the precedent and turned it into law.
The rule cut into his own house first. He named his eldest son, Tuoba Si, as heir, and ordered the death of the mother of Tuoba Si, Lady Liu. The young man wept day and night and could not stop. Tuoba Gui summoned him. The son was still crying. The father lost his temper.
Tuoba Si fled and hid outside the capital.
A man who could press a grassland into a state could also press his own family into this shape.
In his last years Tuoba Gui began taking a mineral drug known as cold-food powder. It heated the body and inflamed the mind. His temper went from bad to worse. He executed officials on small pretexts. Men came to court in the morning not knowing whether they would go home at night.
The official history does not cover for him. It states plainly that the emperor had long taken the powder, and then it gives a list of names.
The Last Night
In 409 he had Lady He confined over a minor matter and announced that she would be punished.
Lady He was the mother of Tuoba Shao, and she had once been the wife of an uncle of the emperor. Years earlier Tuoba Gui had seen her, killed her husband, and taken her into his own household. The official history records this briefly and does not soften it.
From confinement she sent her son a message. Come and get me out.
Tuoba Shao, sixteen, took a handful of retainers over the palace wall.
And so we are back at the beginning.
The emperor started up from the bed. He felt for the bow. He felt for the knife. Neither was there. He moved around the pillars of the hall. It did not help.
He died at thirty-nine.
Tuoba Shao did not last. His elder brother Tuoba Si came back from hiding, killed him, and killed Lady He as well. Then Tuoba Si took the throne.
The new emperor buried his father at Shengle and kept the rule about mothers exactly as it was.
It stayed in force for more than a century. Northern Wei emperors named heirs and killed their mothers, one generation after another, until the line reached the son of Emperor Xiaowen, and the rule was finally abolished.
Eighty years after his death, a later emperor of the Northern Wei unified the north. Later still, Emperor Xiaowen moved the capital to Luoyang, changed the family name to Yuan, and ordered his people into Chinese dress and speech. The first great Buddhas at Yungang were cut by the generation of his grandson.
What that rule left behind cuts deeper than any stone monument.
In what is now Horinger County in Inner Mongolia, a low earthen walled town still stands where Shengle used to be. The rammed earth survives in broken stretches. The wind takes a little more of it every year.
On the Fangshan hill outside Datong there is a great tomb called Yongguling, but that belongs to Empress Dowager Feng, who lived much later. The tomb of Tuoba Gui has never been opened. Nobody can point to it with certainty.
A man who built a state left behind, in the histories, only the name of a tomb.