Srimad Bhagavatam Canto 10, Chapter 01, Text 42

SB 10.1.42

yato yato dhavati daiva-coditam
mano vikaratmakam apa pañcasu
gunesu maya-racitesu dehy asau
prapadyamanah saha tena jayate
 
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
At the time of death, according to the thinking, feeling and willing of the mind, which is involved in fruitive activities, one receives a particular body. In other words, the body develops according to the activities of the mind. Changes of body are due to the flickering of the mind, for otherwise the soul could remain in its original, spiritual body.
 
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
One can very easily understand that the mind is constantly flickering, changing in the quality of its thinking, feeling and willing. This is explained by Arjuna in Bhagavad-gita (6.34):
 
cañcalam hi manah krsna
pramathi balavad drdham
tasyaham nigraham manye
vayor iva suduskaram
 
The mind is cañcala, flickering, and it changes very strongly. Therefore Arjuna admitted that controlling the mind is not at all possible; this would be as difficult as controlling the wind. For example, if one were in a boat moving according to the wind on a river or the sea, and the wind were uncontrollable, the tilting boat would be very much disturbed and extremely difficult to control. It might even capsize. Therefore, in the bhava-samudra, the ocean of mental speculation and transmigration to different types of bodies, one must first control the mind.
 
By regulative practice one can control the mind, and this is the purpose of the yoga system (abhyasa-yoga-yuktena). But there is a chance of failure with the yoga system, especially in this Age of Kali, because the yoga system uses artificial means. If the mind is engaged in bhakti-yoga, however, by the grace of Krsna one can very easily control it. Therefore Sri Caitanya Mahaprabhu has recommended, harer nama harer nama harer namaiva kevalam. One should chant the holy name of the Lord constantly, for the holy name of the Lord is nondifferent from Hari, the Supreme Person.
 
By chanting the Hare Krsna mantra constantly, one can fix the mind on the lotus feet of Krsna (sa vai manah krsna-padaravindayoh) and in this way achieve the perfection of yoga. Otherwise, the flickering mind will hover on the platform of mental speculation for sense enjoyment, and one will have to transmigrate from one type of body to another because the mind is trained only in relation to the material elements, or, in other words, to sense gratification, which is false. Maya-sukhaya bharam udvahato vimudhan (Bhag. 7.9.43). Rascals (vimudhan), being controlled by mental speculation, make huge arrangements by which to enjoy life temporarily, but they must give up the body at the time of death, when everything is taken away by Krsna’s external energy (mrtyuh sarva-haras caham). At that time, whatever one has created in this life is lost, and one must automatically accept a new body by the force of material nature. In this life one may have constructed a very tall skyscraper, but in the next life, because of one’s mentality, one may have to accept a body like that of a cat, a dog, a tree or perhaps a demigod. Thus the body is offered by the laws of material nature. Karanam guna-sango ’sya sad-asad-yoni janmasu (Bg. 13.22). The spirit soul takes birth in higher and lower species of life only because of his association with the three qualities of material nature.
 
urdhvam gacchanti sattva-stha
madhye tisthanti rajasah
jaghanya-guna-vrtti-stha
adho gacchanti tamasah
 
“Those situated in the mode of goodness gradually go upward to the higher planets; those in the mode of passion live on the earthly planets; and those in the mode of ignorance go down to the hellish worlds.” (Bg. 14.18)
 
In conclusion, the Krsna consciousness movement offers the topmost welfare activity for human society. The saner section of human society must therefore take this movement very seriously for the benefit of all humanity. To save oneself from the repetition of birth and death, one must purify his consciousness. Sarvopadhi-vinirmuktam tat-paratvena nirmalam. One must be freed from all designations “I am American,” “I am Indian,” “I am this,” “I am that” and come to the platform of understanding that Krsna is the original master and we are His eternal servants. When the senses are purified and engaged in Krsna’s service, one achieves the highest perfection. Hrsikena hrsikesa-sevanam bhaktir ucyate. The Krsna consciousness movement is a movement of bhakti-yoga. Vairagya-vidya-nija-bhakti-yoga. By following the principles of this movement, one becomes disassociated from material mental concoctions and is established on the original platform of the eternal relationship between the living entity and the Supreme Personality of Godhead as servant and master. This, in summary, is the purpose of the Krsna consciousness movement.
Srimad Bhagavatam Canto 10, Chapter 01, Text 41
Srimad Bhagavatam Canto 10, Chapter 01, Text 43