Shukracharya was the guru of asuras, who had done great penance and gained Mrita Sanjeevani Mantra from Bhagavan Shiva.
With this mantra, life could be restored to any Asura who died in battle, which lead to thhe asuras gaining a lead in the war against Devas.
Devaguru Brihaspati sends his son Kacha to shukracharya, to become his disciple and learn the vidya. Shukracharya, being one who loved teaching and learning, took Kacha in despite knowing he was sent by the Devas, and despite the objections of the asuras. He planned to teach him everything he wanted, except the Mirta Sanjeevani Mantra. Kacha was earnest, and soon became Shukracharya's favourite disciple. This led to other disciples becoming jealous of Kacha, and start making evil plans against him. Meanwhile, Devayani, the daughter of Shukracharya and Jayanti (daughter of Indra) falls in love with Kacha.
Assisted by the Asura lords, who were vary of Kacha and didn't want him to know the Mrita Sankeevani Mantra, the other disciples kill Kacha when he goes out to collect firewood, and feed him to a pack of wolves. Devayani gets worried when he doesn't return, and pleads with her father to know about his whereabouts. Shukracharya with his Divya Drishti figures out that he was eaten by wolves. Devayani pesters and pleads with her father to get him back to life. She being his only pampered child, he brings Kacha back to life with the mantra.
The asuras kill Kacha again and again, but Shukracharya keeps bringing him back to life.
After a while, the asuras kill kacha again, but this time they burn him to ashes, and mix the ash into a pot of wine, and present it to Shukracharya. Unaware of this, Shukracharya drinks the wine. Devayani again gets worried and goes to her father, who promptly uses the Mantra again. But this time, Kacha respawns inside Shukracharya's stomach. For Kacha to live, he had to come out bursting Shukracharya's stomach, which would kill him. Devayani cries, saying that it would be devestating for her to lose either of them.
Shukracharya then teaches Mrita Sanjeevani vidya to Kacha, and tells him that once he comes back to life, he should use the vidya and get Shukracharya back to life. Thus, Kacha and shukracharya both survive. Frustrated at the situation, Shukracharya then passes a curse saying "Anyone who is in vedabhyasa is not permitted to drink alcohol. Anyone who does would lose his vidya". He goes to the Asuras and berates them, telling them that it was because of their plans that Kacha now knows the Mantra.
After his Vidyabhyasa, Kacha pays respects to his guru, and prepares to leave for his home. Devayani comes up to him, confesses her love and asks him to marry her and stay with her. Kacha says his duty needs him to go back home, and that as she is guru putri, she is like his sister and also as he came out of her father, he is like a son to him.
Hurt and angry, Devayani lays a curse on him that the Mrita Sanjeevani mantra will not be effective when used by him. Kacha accepts the curse, but also lays a curse on Devayani in return, since she cursed him despite sticking to his dharma, He cursed her that she could never marry a Brahmin.
Kacha, while unable to use the Mantra himself, could teach the mantra to devatas. Hence, balance was restored to the conflict.