Shiva's anger brought Brahma back to his rational mind, causing him to repent. Recognizing that it all happened due to the influence of Kama's arrow, he cursed Kama to be burned into ashes by Shiva.