Based on the 11th-century of Indian Legends, Fairy Tales and Folk Tales as told in Sanskrit by Poet Somadeva Bhatt in his book Kathasaritsagara (which means "Ocean of the Streams of Stories") a collection of 18 books. Vikram Aur Betaal is based on 12th book titled Betaal Pacchisi. These are spellbinding stories told to the wise King Vikramaditya by the wily ghost Betaal. Vikramaditya king of Ujjain receives, among other visitors, a mendicant who presents the king a fruit on every visit. In the fruits are later discovered orbs of ruby. Upon this discovery, the king resolves to visit the mendicant, who arranges a meeting under a banyan tree in a cremation ground beyond the city, at night, on the 14th day of the dark half of the month. At the meeting, the mendicant requests that Vikramaditya bring him a corpse suspended from another tree, with which the mendicant might achieve occult power. Upon Vikramaditya's doing so, the corpse is identified as Betaal, the ghost, who narrates a story to the king, concluding that Vikramaditya must answer a moral question pertaining to the story's characters, on pain of his own death; and upon his answering the question, Betaal returns to his tree. This sequence repeats 25 times until Betaal reveals the mendicant's plan was to kill the king after obtaining power from Betaal himself. Thus forewarned, Vikramaditya kills the mendicant after their meeting.