Having attained omniscience (Kevala-jnana) on the bank of Rju-kula and after preaching the principle of Jainism through his divine voice (divya-dhvani), lord Mahavira toured over different areas of the country and propounded the religious doctrines
Knowing his emancipation very near, Lord Mahavira approached Pavapuri alias Apapa town. The heavenly gods created Samosaran (beautiful dome). Bhagwan Mahavir sat on golden throne inside Samosaran. There were twelve beautiful qualities surrounded him. It was Kali Chaudash. His principal eleven disciples were present including Gautamswami. Heavenly gods and goddesses, other people too were present.
He had royal patronage too. Rich financiers and merchants, kings, queens and princes and their ministers were followers of Mahavir. Some of them were present to witness the last moments and last discourses of Mahavir.
Mahavir gave discourses for 16 Praharas continuously i.e. two days and two nights without any break. In these 16 praharas he spoke on 55 chapters of Punya (merits) and 55 chapters of Paap (demerits). These are well-known as Uttaradhyayan Sutra in Jainism. Mahavir also forecasted the horrible future of fifth and sixth Aras of present Avasarpini.
As soon as the time for emancipation reached nearer Mahavir asked Gautam to go to a farmer named Devsharma and enlighten his soul with knowledge. This was the day of Amavasya in the month called Ashwin.
At midnight on that day Mahavir attained emancipation and relinquished this universe forever. He sat on the deat of salvation. He will never return from there. His emancipation caused extinguishes of Bhav Deepak and turned the atmosphere into darkness and hence those who were present at that time lighted Dravya Deepak. Dipavalee festival since then commenced for Jains. It is celebration of NIRVANA KALYANAK and not enjoyment of worldly pleasures. Why? Because we wish to have NIRVANA as early as possible.
Later on Gautamswami returned after meeting Devsharma. He learnt about emancipation of Mahavir and began crying. He then went into deep thinking and converted these thoughts into meditation and concentration of non-attachments. At the dawn of first day of the new month i.e. Kartik he achieved luminous and brilliant kevalgyan (Omniscience). Heavenly gods celebrated his kevalgyan with all gaiety and pleasures.
There is one more belief as to why the festival is referred to as the festival of lights. Early in the morning subsequent to the day of Diwali, Ganadhar Gautam Swami, the foremost follower of Lord Mahavir achieved total enlightenment. This could be a more likely cause for observing Diwali as the festivals of lights.