Even though he was but a commoner, he would often attend court proceedings whenever he saw people disputing with each other, and make decisions about how he would have ruled had he been the magistrate, as he himself as capable of being an official in the future.
He was shortly after made a Zuo Shiyi (左拾遺), a low-level consultant at the examination bureau of government (門下省, Menxia Sheng), and served as one of the editors of the imperial history.
[3] During the middle of the Qingtai era (934-936) of Li Siyuan's adoptive son Li Congke, Zhang returned to the imperial government to serve as Bibu Langzhong (比部郎中), a supervisory official at the ministry of rites, as well as drafter of edicts and imperial scholar.
(Li Congke thereafter, finding the situation hopeless, committed suicide, ending Later Tang and allowing Shi's Later Jin to take over its former territory.
[7][8] Around 937, Zhang made an attempt to flee back to Chinese territory, but was captured by the Khitan border guards.
After this incident, Zhang continued to serve Emperor Taizong, and was said to be faithful and honest, speaking straight off his mind without hiding anything.
[9] Early in Emperor Taizong's Huitong era (938–947), he was promoted to be chief imperial scholar (翰林學士承旨, Hanlin Xueshi Chengzhi) and the minister of civil service affairs (吏部尚書, Libu Shangshu).
[10] In 946, Emperor Taizong launched a major attack south, and, after defeating and forcing the surrender of the major Later Jin general Du Wei (Shi Jingtang's brother-in-law, Shi Chonggui's uncle), approached the Later Jin capital Kaifeng.
Finding the situation hopeless, Shi Chonggui surrendered, ending Later Jin and allowing (for the time being) Liao to take over its territory.
Zhang himself was subsequently commissioned as You Puye (右僕射, one of the heads of the executive bureau (尚書省, Shangshu Sheng)), Menxia Shilang (門下侍郎, the deputy head of the examination bureau), and chancellor (同中書門下平章事, Tong Zhongshu Menxia Pingzhangshi).
)[12] The Liao soldiers mistreated the Chinese of the Central Plains badly, however, and soon the realm was overrun with rebellions.
Finding the situation troubling, Emperor Taizong decided to head back to Liao proper, leaving his brother-in-law Xiao Han (the brother of his deceased wife Empress Xiao Wen)in charge of Kaifeng as the military governor of Xuanwu Circuit (宣武).
)[8] As Emperor Taizong was traversing the devastated Chinese territory on his way back, he stated, "What we have rendered China to be is the result of the sins of the Prince of Yan [(i.e., Zhao)]."
"[12] Emperor Taizong, however, would never reach Liao proper, as he fell ill on the journey and died near Heng Prefecture (恆州, in modern Shijiazhuang, Hebei).
When Xiao and Emperor Taizong's cousin Yelü Mada (耶律麻荅) subsequently withdrew from the Central Plains to Heng as well, they, still bearing grudges over Zhang's suggestion of commissioning only the Han Chinese to rule the Han Chinese, had their soldiers surround Zhang's mansion.
The late Emperor left me in charge of Bian Prefecture [(汴州, i.e., Kaifeng)] and allowed me to live in the palace, so how did you dare to oppose that I do so?
[1] It was said that because Zhang often spoke righteously and had mercy on those who had talents, and he was willing to praise others for their good deeds and spend his wealth to help the poor, the Chinese scholars of the Central Plains, upon hearing of his death, mourned him.