In early Buddhist legends, Vajrapāni is a minor deity who accompanied Gautama Buddha during his career as a wandering mendicant. In some texts he is said to be a manifestation of Śakra, king of the Trāyastriṃśa heaven of Buddhist and Hindu cosmology and god of rain as depicted in the idols of the Gandharva. As Śakra, it is said that he was present during the birth of Tathagata. As Vajrapāni he was the god who helped Gautama escape from the palace at the time of his renunciation. When Sakyamuni returned from Kapilavastu he is stated to have assumed eight forms of devas who escorted him.