Srimad Bhagavatam Canto 03, Chapter 12, Text 33

SB 3.12.33

sa ittham grnatah putran
 puro drstva prajapatin
prajapati-patis tanvam
 tatyaja vriditas tada
tam diso jagrhur ghoram
 niharam yad vidus tamah
 
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
The father of all Prajapatis, Brahma, thus seeing all his Prajapati sons speaking in that way, became very much ashamed and at once gave up the body he had accepted. Later that body appeared in all directions as the dangerous fog in darkness.
 
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
The best way to compensate for one’s sinful acts is to give up one’s body at once, and Brahma, the leader of the living entities, showed this by his personal example. Brahma has a fabulous duration of life, but he was obliged to give up his body due to his grievous sin, even though he had merely contemplated it in his mind without having actually done it.
 
This is a lesson for the living entities, showing how sinful an act it is to indulge in unrestricted sex life. Even to think of abominable sex life is sinful, and to compensate for such acts, one has to give up his body. In other words, one’s duration of life, blessings, opulence, etc., are decreased by sinful acts, and the most dangerous type of sinful act is unrestricted sex.
 
Ignorance is the cause of sinful life, or sinful life is the cause of gross ignorance. The feature of ignorance is darkness or fog. Darkness or fog still covers the whole universe, and the sun is the only counteracting principle. One who takes shelter of the Lord, the perpetual light, has no fear of being annihilated in the darkness of fog or ignorance.
Srimad Bhagavatam Canto 03, Chapter 12, Text 32
Srimad Bhagavatam Canto 03, Chapter 12, Text 34