Nag and Nagaina don't believe in live and let live. On the contrary, they see just about everyone and everything around them as a real and present threat. That includes the human family with whom the mongoose Rikki-Tikki-Tavi has been staying. Nag and Nagaina are concerned that if these humans discover their nest, they will surely destroy the unhatched eggs inside it.
Add to that the fact that the family are guarded and protected by a mongoose, one of the natural world's greatest enemies of snakes, and it's all the more important that the two king cobras should deal with this threat sooner rather than later.
They come up with a dastardly plan to attack the family at night and take Rikki out at the same time. This will be a war to the death, a fight to the finish; no quarter will be given on either side and none asked for. And Rikki knows this. Eternally grateful to the human family for taking care of him after he nearly drowned in a flood, Rikki is fiercely loyal to them and will do anything to protect them, especially the boy Teddy, with whom he's developed an especially close bond.
When the night of the attack comes, Rikki springs into action and kills Nag. But there's still unfinished business: Nagaina needs to be taken care of. So the very next morning Rikki ruthlessly hunts down Nagaina's nest and destroys all but one of her eggs. Nagaina is nowhere to be seen; she's on her way to the human family with the express intention of killing them. Rikki dashes off and manages to distract Nagaina just in the nick of time. After following her deep into her lair, Rikki then kills Nagaina. The war is now over.