Lord Shiva was in Mandarachal and Kashi was ruled by a very pious and religious King named Divodas. In his Kingdom every one was very happy and there was all round prosperity. He had reached an understanding with Lord Brahma that as long as he was ruling, Devas and other celestial beings should stay away from Kashi and should not create any disturbance in Kashi.
Lord Brahma more or less agreed to it but on one condition that King Divodas should prove himself an excellent and able administrator and all people living in Kashi or visiting Kashi should be treated well in their religious pursuits. The King agreed to it and accordingly gave excellent governance.
Lord Shiva was very upset at being away from Kashi for a long time and he wanted to make King Divodas commit some mistake. Accordingly, he sent sixty four Yoginis to create some disturbance, but they were enthralled by the beauty and serene surroundings of Kashi which appeared to be a part of heaven. They ultimately settled down there.
When the Yoginis failed to return, Lord Shiva sent Lord Surya with instructions to create some disturbance in Kashi so as to defeat King Divodas in his resolve. Lord Surya came to Kashi and disguised himself as an astrologer, a learned scholar, a religious propagator, a businessman, a brahmin etc. But he could not find any fault with any person in Kashi or with the governance of King Divodas. Lord Surya was also very much attracted towards Kashi and the beauty of the city. Lord Surya thought, if he went back to Mandarachal without fulfilling the wishes of Lord Shiva, the latter would get angry.
Lord Surya finally decided to stay in Kashi. He said to himself, disobeying the instructions of Lord Shiva is a sin, but by staying in Kashi and undertaking religious activities, such sins will easily get cleansed. Accordingly Surya settled down in Kashi for the time being. Lord Surya is worshipped in his twelve forms and Kashi Khand has narrated the importance of the twelve Adityas as under :