The Mahabharata is one of the two major Sanskrit epics of ancient India.
Besides its epic narrative of the Kurukshetra War and the fates of the Kauravas and the Pandava princes, the Mahabharata contains much philosophical and devotional material, such as a discussion of the four "goals of life" or purusharthas. Among the principal works and stories that are a part of the Mahabharata are the Bhagavad Gita, the story of Damayanti, an abbreviated version of the Ramayana, and the Rishyasringa, often considered as works in their own right.
Traditionally, the authorship of the Mahabharata is attributed to Vyasa. There have been many attempts to unravel its historical growth and compositional layers. The oldest preserved parts of the text are not thought to be appreciably older than around 400 BCE, though the origins of the story probably fall between the 8th and 9th centuries BCE. The text probably reached its final form by the early Gupta period (ca. fourth century CE). The title may be translated as "the great tale of the Bharata dynasty". According to the Mahabharata itself, the tale is extended from a shorter version of 24,000 verses called simply Bharata.
The Mahabharata is the longest Sanskrit epic. Its longest version consists of over 100,000 shloka or over 200,000 individual verse lines (each shloka is a couplet), and long prose passages. About 1.8 million words in total, the Mahabharata is roughly ten times the length of the Iliad and Odyssey combined, or about four times the length of the Ramayana. W. J. Johnson has compared the importance of the Mahabharata to world civilization to that of the Bible, the works of Shakespeare, the works of Homer, Greek drama, or the Qur'an.
The epic is traditionally ascribed to the sage Vyasa, who is also a major character in the epic. The first section of the Mahabharata states that it was god Ganesha who, at the request of Vyasa, wrote down the text to Vyasa's dictation. Ganesha is said to have agreed to write it only on condition that Vyasa never pause in his recitation. Vyasa agreed, provided Ganesha took the time to understand what was said before writing it down.
The epic employs the story within a story structure, otherwise known as frametales, popular in many Indian religious and non-religious works. It is recited to the King Janamejaya who is the great-grandson of Pandava prince Arjuna, by sage Vaisampayana, a disciple of Vyasa. The recitation of Vaisampayana to Janamejaya is then recited again by a professional storyteller named Ugrasrava Sauti, many years later, to an assemblage of sages performing the 12 year long sacrifice for King Saunaka Kulapati in the Naimisha forest.
Jaya, the core of Mahabharata is structured in the form of a dialogue between Kuru king Dhritarashtra and Sanjaya, his advisor and chariot driver. Sanjaya narrates each incident of the Kurukshetra War, fought in 18 days, as and when it happened. Dhritarashtra sometimes asks questions and doubts and sometimes laments, knowing about the destruction caused by the war, to his sons, friends and kinsmen. He also feels guilty, due to his own role, that led to this war, destructive to the entire Indian subcontinent.
In the Bhagavad Gita, Krishna explains to Arjuna his duties as a warrior and prince and elaborates on different Yogic and Vedantic philosophies, with examples and analogies. This has led to the Gita often being described as a concise guide to Hindu philosophy and a practical, self-contained guide to life. In modern times, Swami Vivekananda, Bal Gangadhar Tilak, Mahatma Gandhi and many others used the text to help inspire the Indian independence movement.