In the 670s, at the Tang capital of Changan, a case file was carried into the imperial presence.
A general of the guard, Quan Shancai, had cut down a pine tree at the tomb of the previous emperor. The judges of the Grand Court had recommended that he be stripped of his office.
The emperor read it and gave his decision in two words. Put him to death.
This is not a story about finding a criminal. The tree was cut, and nobody argued otherwise. It is a story about a confrontation between a throne and a junior judge, and about the question underneath it: what a tree is worth, and who decides.
The judge was Di Renjie. A thousand years later a Dutch diplomat would turn him into Judge Dee, the detective of the English-language Chinese mystery novel. But what the real Di Renjie did in this room was not deduction. It was refusal.
He won. And he won not by pleading, but by citing two cases that were already a hundred years old.

Why a tree was worth this much
Begin with the tree.
The tomb is that of Emperor Taizong, in the hills at Liquan county, Shaanxi. A Tang imperial tomb was not a grave. It was an institution: the mountain, the cypress park, the offering hall, the lower palace.
The pines and cypresses around it were not landscaping. They formed what the sources call the cypress wall, a ring of trees that marked where the sacred ground began and the ordinary hillside ended. Most of the work of maintaining a Tang imperial tomb consisted of maintaining those trees.
To cut one inside that ring was a different act from cutting firewood on the slope outside it.
The Tang code had a specific provision for vegetation inside the tomb parks: felling it was punished with two and a half years of penal servitude. Note the verb. The law was aimed at theft, at taking without permission.
Quan had not taken. The file said he had cut the tree by mistake.
That word is where the trouble starts. A mistaken felling is not theft. It is closer to careless destruction, a negligent act rather than a profitable one, and on that reading the Grand Court recommended only dismissal from office.
Classical Chinese law drew the line between gu, the deliberate act, and shi or wu, the accidental one, and did so with some care. A killing by accident was not a killing by intent; a fire started carelessly was not arson. The whole point of the distinction was to keep the penalty attached to the intention rather than to the damage.
Here the damage was to an imperial tomb, and the intention was nothing at all. That combination is precisely the sort of case in which a code either works or is shown to be decoration.
The emperor read it differently, and his reasoning had nothing to do with trees.
He said: by cutting the tree on the tomb, this man has made me unfilial.
In Tang political language that sentence was enormous. An emperor could be called cruel; he could not be called unfilial. So the charge quietly changed shape. It was no longer damage to tomb vegetation. It was a son who had failed his father, and the general had done it to him.
Once the charge changes shape, the penalty follows it upward.
Three sentences
Di Renjie said: the penalty should be dismissal.
That was not his personal view. That was the opinion of the court he served in, delivered formally, and delivering it was his job.
The institution matters here. The Grand Court was not a court of first instance and not a ministry. It was the body that reviewed sentences coming up from the provinces and from the capital, checked them against the code, and reported to the throne. Its officers were legal specialists, not moral advisers, and their authority rested on knowing the statutes better than the men who outranked them.
That is why the emperor could not simply overrule him with a shout. He could overrule him, and did, but the record would show that the reviewing officer had twice submitted that the sentence was wrong.
The emperor said: execute him immediately.
Di Renjie said: the penalty should not be death.
The Old Book of Tang records what happened to the imperial face in four characters: the emperor changed countenance.
The men standing beside Di Renjie began to signal to him. The phrase in the text is that those around him looked at him and indicated that he should withdraw.
This was a well-understood courtesy of the Tang court. The sovereign had lost his temper. If the official now stepped back and left the room, the matter could still be turned; if he stood where he was, it became a confrontation on the record.
Di Renjie did not step back.
What he said instead
His first move was not law. It was position.
He said: I have heard that it is hard to stroke a dragon backwards, and hard to oppose the will of a ruler. I have always thought this wrong. Under Jie and Zhou it was hard. Under Yao and Shun it is easy.
Jie and Zhou were the proverbial tyrants; Yao and Shun the proverbial sage kings. The sentence leaves the emperor with two doors. He may agree that this is an age of Yao and Shun, in which case he has just promised to listen. Or he may deny it, which places him in the other category.
He chose the first door, silently, by letting the judge continue.
Then came the precedents.
The first was from the Han dynasty. Someone had stolen a jade ring from the shrine of the founding emperor. Emperor Wen wanted the man family wiped out. Zhang Shizhi, the commandant of justice, sentenced him to public execution instead, on the ground that the law had reached its limit and that a judge who invents a punishment above the code has no code left when a worse crime arrives.
The second was from the Wei dynasty. Emperor Wen of Wei ordered a hundred thousand military households moved from Ji province to the south bank of the Yellow River. Xin Pi seized the imperial robe and held on. The emperor pulled free and walked away; Xin Pi grabbed the robe again. In the end half the households were moved.
Two cases, one distant and one near, making the same point. An emperor losing his temper and an emperor signing a judgment are two different events. In both of the earlier cases, the throne had given way.
Then he said the sentence that Chinese legal history keeps quoting.
You, Majesty, made the law and hung it at the gate tower. Penal servitude, exile and death each have their grade. How can a man whose offence does not reach the highest grade be ordered to die? If the law has no constant, where are the millions to put their hands and feet?
The gate tower is the xiangwei, the watchtower outside the palace where statutes were displayed so that the public could read them. The argument is not about mercy. It is about predictability. A man needs to know what penalty follows what act, or he cannot plan a life. A society in which nobody can predict the consequence of an act is a society in which nobody dares to act.
He added one more turn, and this one was aimed at the record rather than the code.
Suppose someone stole a handful of earth from the tomb of the Han founder. What penalty would you have left? Now you kill a general over one pine at Zhaoling. In a thousand years, what kind of ruler will they say you were?
That is not jurisprudence. That is historiography, used as pressure.
The Old Book of Tang closes the scene in six characters. The imperial mood eased slightly, and Quan Shancai escaped death because of it.
A few days later
A few days afterwards, Di Renjie was appointed investigating censor.
That detail is more interesting than the acquittal. What happened in that room was not a compromise. It was an exchange. The emperor accepted the principle that anger is not a ground of judgment, and then gave the man who had stated the principle a better post.
Tang politics did not often work that way, but it was not unique either. It required one condition: the emperor had to know that he had been about to do something wrong.
The other record
The same case appears in a second source, the Comprehensive Institutions of Du You, and it is not the same case.
In the ninth month of the third year of Shangyuan, it says, the left guard general Quan Shancai and the right gate commander Fan Huaiyi together cut the pines at Zhaoling. The emperor specially ordered them killed. The Grand Court proposed to ruin their families and strike their names from the register. Di Renjie, assistant of the Grand Court, submitted against it, saying the penalty should not be death.
Three differences.
First, there were two men, not one.
Second, the word mistake is absent. The Old Book says felled by error. The Comprehensive Institutions says felled. One character, and the mental element changes: negligence becomes something that might have been deliberate.
Third, the recommendation was harsher. Dismissal in one version; ruin and expulsion from the official rolls in the other.
On dating the two accounts agree more than they appear to. The eleventh month of Shangyuan 3 was renamed Yifeng, so the phrase in the middle of the Yifeng period and the ninth month of Shangyuan 3 are the same year, 676.
What the discrepancy tells us is something about how history is written. The compilers of the Old Book of Tang, working three decades after the fall of the Tang, chose the version that made the better story: one man, an accident, a light offence, and therefore an emperor behaving absurdly. The Comprehensive Institutions, compiled closer to the archives, keeps two men and a heavier charge.
Both versions are left standing here. What they share is the only thing that matters to the case. The first instinct of the throne was to kill. The first instinct of the judge was that killing was wrong.
He did it twice
The Old Book puts another case immediately after this one.
Wang Benli, a senior secretary in the imperial secretariat, was using imperial favour to dominate the court, and the court was afraid of him. Di Renjie memorialised the throne asking that he be handed to the judicial authorities.
The emperor granted a special pardon.
Di Renjie memorialised again. The state may lack talent, he wrote, but it does not lack men like Wang Benli. Why would Your Majesty begrudge a criminal and instead damage the kingly law? If you insist on pardoning him out of turn, then send me away to some place where there are no people, and let me serve as a warning to those who would speak honestly in future.
Wang Benli was convicted. The court, the historian notes, became quiet and orderly.
Read the two cases together and the position becomes clear. Di Renjie was not opposed to the emperor killing people. He was opposed to the emperor killing people without law. The first is mercy. The second is legality. They are constantly confused with one another, and institutionally they have nothing in common.
Why this is a detective story after all
The reason an English-speaking reader knows the name Di Renjie at all is Robert van Gulik.
Van Gulik was a Dutch diplomat posted to Chongqing during the war, where he found a Qing dynasty detective novel about a Judge Dee and translated it. He then wrote two dozen detective novels of his own in English, with a Chinese judge as the investigator, and they sold all over the world.
Those books are about the pleasure of the puzzle: a body, a locked room, a false accusation, and a magistrate who sees what everyone else has missed.
It is worth saying what van Gulik was drawing on. China had a continuous tradition of case literature going back to the Song dynasty collections, and a forensic manual, the Washing Away of Wrongs, printed in 1247, which is the oldest surviving systematic text on medical evidence in the world. The genre was not a European import dressed in silk. It existed, and it was technical.
The real Di Renjie was good at that too. The same biography records that in his first year at the Grand Court he cleared a backlog of cases involving seventeen thousand people, and that not one of them petitioned afterwards claiming injustice.
But the pine tree was not a puzzle. Everyone knew who had cut it.
What it required was a man who understood three things at once: that the emperor was angry, that the men beside him were offering a way out, and that a single further sentence could end his career or his life. He understood all three and spoke anyway.
And then the anger passed.
Six characters, at the end of the entry. The imperial mood eased slightly.
That is all the record gives us. The rage of the most powerful man in the world, and the stubbornness of one official, resolved in two words meaning a little.