This is a state of perfect Tantric wisdom, which also confers the ability for the body to transmute into a nonmaterial body of light that can manifest anywhere and anytime to help others (thus Padmasambhava can appear as a result of his followers’ guru yoga).
Further, Padmasambhava’s consort, as well as a second consort, hid many of his esoteric (Tantric) teachings (termas), so they could be discovered by later followers (tertons) who had attained a high level of spiritual power.
It was later said that when a Tibetan king had invited a Buddhist teacher from India to come teach the Dharma there, demons hindered him. So they called Padmasambhava to come, and he tamed the demons, which agreed to henceforth serve the Dharma in Tibet. This is the explanation for the various fierce deities that one sees in Tibetan Buddhism.