In 906, as Zhu was planning on seizing the Tang throne and establishing his own dynasty (which he eventually did, establishing Later Liang as its Emperor Taizu), Ding defected to Zhu's rival Li Keyong the military governor of Hedong Circuit (河東, headquartered in modern Taiyuan, Shanxi) and thereafter served in Li Keyong's state of Jin until his death.
When he grew older, the Tang realm was then overrun by agrarian rebellions, and he gathered strong young men around him to engage in banditry, gaining some acclaim in the process.
Zhu reacted by sending Ding, Ge, Pang Shigu (龐師古), and Huo Cun (霍存) to attack Weibo.
Later in the year, Ding and Zhang Guiba (張歸霸) engaged Zhu Jin the military governor of Taining Circuit (泰寧, headquartered in modern Jining, Shandong), who had been locked in years of warfare with Zhu Quanzhong; they defeated him and inflicted great casualties on his troops; he himself barely escaped.
[6] In 904, Zhu forced Emperor Zhaozong, who was then under his physical control, to move the capital from Chang'an to Luoyang.
When the news of Emperor Zhaozong's death reached Zhaoyi, Ding had his army bear mourning clothes and wept for a long time.
Thereafter, in 906, when Zhu was attacking Liu Rengong the military governor of Lulong Circuit (盧龍, headquartered in modern Beijing) and Li Keyong tried to aid Liu by attacking Zhaoyi again to divert Zhu's troops, Ding surrendered the circuit.
Therefore, I submit to you.Li Keyong treated him with great respect, putting him in honored position above other officers, but made Li Sizhao the acting military governor of Zhaoyi to replace him.
Li Keyong maintained the Tang era name (and is commonly viewed as the ruler of his own state from this point on, under the Tang-bestowed title of Prince of Jin).