Ashvatthama was Dronacharya’s son. Dronacharya pleased Shiva by his penance and had Ashvatthama from him as a blessing. He was an active participant in the battle of Mahabharata. He defeated Ghatotkhacha, Bheem’s son, and killed Ghatotkhacha’s son, Anjanparva. He also killed Drupadkumar, Shatrunjay, Balaanik, Jayaanik and King Shrutahu. He even killed the ten sons of Kuntibhoj. Ashvatthama was very angry when he came to know about Dronacharya’s death. Drona received Narayanaastra by pleasing Narayan. He it on to Ashvatthama but asked him to use it wisely. He decided to use it to kill Dhrishtadyumna. When Krishna saw that Ashwatthama used Narayanaastra, he asked all his soldiers to drop their weapons as this was the only solution. But Bheema didn’t listen and the weapon hit him in his head continuously. Krishna brought him down from the Balaat Rath thereby saving him from the weapon. Aswatthama used Aagneyaastra but it hurt everyone except Krishna and Arjuna. Ashvatthama was confused. Then Vyas appeared and told him that Krishna was Vishnu himself who has pleased Shiva by his prayers and so Mahaamuni Nar (Arjuna) appeared. So Krishna and Arjuna are Narayan himself. Ashvatthama greeted Narayan, Shiva and Nar in his thoughts and left for his camp. Fighting under Karna’s command, Ashvatthama promised that he will take off his armour only after killing Drashtadhumnya.
The battle continued for 18 days. When Ashvatthama came to know about the sinful ways of Duryodhana, he was very angry. He killed all the sleeping Panchals. When Draupadi came to know about it, she started a hunger strike which would stop only when she’ll have Ashvatthama’s gem which he always wore on his forehead. Ashvatthama used Brahmaastra on Arjuna. He prevented it by the Pashupat Astra of Shiva. Ashvatthama even attacked pregnant Uttara to kill Pandava's successor. Arjuna also released Brahmaastra in reply to Asvatthama’s Brahmaastra. Ashvatthama released the weapon to kill Pandavas but Arjuna released it to neutralise Ashvatthamas Brahmaastra. Following Narad and Vyasa’s advice, Arjuna pulled back his weapon but Ashvatthama claimed he was unable to pull it back. Krishna said, "Uttara will have a son named Parikshit and if he is killed by your Brahmaastra, then I’ll give him life again. He will be the king of earth and you? You are a scroundrel. You have killed hundreds of people and will roam in lone lands for three thousand years. Your body will always smell of blood and will have many diseases." Vyas approved Krishna’s words. Asvatthama wished to live with Vyas. He always had a precious stone on his forehead which gave him strength against demons, weapons, deities, serpents etc. Draupadi asked to have it and following Narad and Vyas’s advice, he gave it to her.
Ashvatthama killed Draupadi’s som during sleep. So Draupadi asked Arjuna to present her Ashvatthama’s head. Arjuna, with Krishna as his charioteer, went to fight with Ashvatthama. Ashvatthama only knew how to use Brahmaastra and didn’t know how to retrieve it. He still used it. Arjuna cut him with the Brahmaastra but retrieved the two Brahmaastra to save the world. He tied Ashvatthama and took him to Draupadi. She felt pity on him and asked Arjuna to let him go but inspired by Krishna, Arjuna took the precious gem from Asvatthama’s forehead and gave it to Draupadi. Like this his promise was kept and then Asvatthama was allowed to go. Krishna said “A fallen Brahmin is also not worth the kill, but a tyrant should not be left unpunished.” And so this saying was followed.