Kelantan Malays prescribe a method of acquiring a shaman's powers that shows an accretion of Muslim belief on a primitive idea, akin to the Proto-Malay superstition that round a grave a ditch must be dug wherein the soul of the deceased may paddle his canoe. Sitting one at the head and one at the foot of the grave of a murdered man, the would-be shaman and a companion burn incense and make believe to use paddles shaped from the midrib of a royal yellow coconut palm, calling the while upon the murdered man to grant magical powers. The landscape will come to look like a sea and an aged man will appear, to whom the request for magic must be repeated. Now one of the evidences of Muslim saintship is the ecstatic vision or dream of the Prophet or of one of the greater saints of Islam. Possibly the "aged man" was Luqman al-Hakim, the reputed fattier of Arabian magic. One day, according to Kelantan belief, the Angel Gabriel was commanded to upset Luqman and his books at sea as a punishment for his pride, and the finders of the few scattered pages of those books became medicine-men in their several countries. A Selangor account corroborates the Kelantan belief that Luqman was the first magician: he lived in the sky, was descended from Adam and Eve, was a son (or perhaps brother) of Siva, and so a link with the Hindu element in the modern Malay medicine-man's shibboleth!
When Islam came, the Malay magician sat at the feet of its pundits, studied their arts of divination, and borrowed their cabalistic talismans. Before his old incantations he set the names of Allah and Muhammad, often in impious contexts. He detected his latest avatar in the living saint of Islam, to whom folk resort "for advice in legal disputes or as to the success or failure of an enterprise or as intercessor for the sick or to get a child or to remove blight or plague or confound enemies." He will, therefore, seclude himself for certain days of the week or for a period, the practice being given an Arabic name and having a religious colour. Sometimes he keeps celibate. Or he may fast to impress the common herd and enable himself to see visions. A magician of this type is generally a disciple of a crude form of Sufism derived from India. A Selangor account, strongly affected by Neo-Platonic ideas, makes Allah (as Absolute Being beyond all relations) the first of magicians. "When haze was still in the womb of darkness and darkness in the womb of haze, before earth bore the name of earth or sky the name of sky, before Allah was called Allah or Muhammad was called Muhammad, before the creation of the Divine Throne and its footstool and the firmament, the Creator of the worlds was manifested by Himself and He was the first magician. He made the magician's universe, a world of the breadth of a tray, a sky of the breadth of an umbrella.... The magician before time existed was Allah and He revealed Himself by the light of moon and sun and so showed Himself to be verily a magician." The first sentence of this quotation is a Malay paraphrase of the Prophet's simile for God before the creation: "the dark mist above which is a void and below which is a void." As Skeat has suggested, the conception of a miniature universe, Plato's "fixed archetypes," would remind the Malay of the relation of the tiny Indonesian soul to the physical body. It reminds also of Ibn 'Arabi's saying that all the universe contains lies potential in God like the tree in the seed. Indeed, one Malay account of the origin of the magician relates how at the Muslim word of creation (kun) "the seed was created and from the seed the root, from the root the stem, and from the stem the leaves," and then in the same sentence relates how the word of creation brought into being a miniature earth and sky. So time has changed the Malay brother of the Siberian shaman into a humble relative of the Sufi mystic.
http://www.shamana.co.uk/animism/sss05.htm