In 853, the story first appeared in Miscellaneous Morsels from Youyang, which was published shortly after he returned to Chang'an after his term of acting Governor of Jizhou (now known as Ji'an in Jiangsu).
According to a legend related in the Youyang Zazu (Youyang Miscellanies) by the Tang Dynasty writer Duan Chengshi (800-863), the Thousand Buddha Mountain was originally located by the sea and the sea god had locked it in place there by a large lock in order to prevent the god in charge of the mountains from moving it around.