The ideas of karma and samsara were evidenced in scriptures from around the 6th century BC and form the basis for Hinduism. The idea is to overcome the eternal cycle of rebirths, samsara. In the Upanishads this is achieved through the spiritual realization that the individual soul Atman is identical with Brahman (world soul) in its essence.
Accordingly, every human being has his or her own dharma (cosmic law on the one hand, social law on the other), which has to be fulfilled, and the fulfilment is decisive for whether deeds bring about good or bad karma. In Hinduism there is on the one hand the generally valid sadharanadharma, which contains the duties of every individual, such as non-violence (ahimsa), truthfulness (satya), patience (ksanti), self-control (dama), charity (danam), hospitality (ahithi). These virtues apply equally to all human beings, but there is no single code for them. The svahdharma, on the other hand, which prescribes the duties of the various classes of society, is authoritative for one particular group at a time. Accordingly, the dharma of a warrior (Kshatriya caste), for instance, is to show war in case of occasion and to kill if necessary. If a warrior has to kill an enemy, this may not cause bad karma, since he has fulfilled his dharma, the task imposed on him. However, if someone kills for other, selfish motives, this may very well result in bad karma. The link between karma and dharma has a very strong ethical and moral component. The theory of karma also offers, among other things, an explanation for the puzzle of apparently uncaused suffering and social inequality.
On the question of the connection between deed and effect, there are several explanations in the Mahabharata. A widespread belief is that the works produce their effect automatically. However, there are also differentiated accounts: Two causes of the soul's attachment, namely, non-knowledge (avidya) and desire (lobha), cause the activity of the sense organs to cause restlessness and clouding of insight. This prevents the saving insight. The works attach themselves to the organ of thought (manas), disturb the redemptive insight and condition the nature of the embodiments (Mbh. 12).
There are several views on the question of how the fruits of deeds are realized: (1) the soul leaves the body after death and is reborn in a new body conditioned by karma. (2) Retribution takes place partly in the hereafter and partly in the new existence. (3) Good karma can bring about a temporary bliss in "heaven," while bad karma can bring about a stay in "hell," but not as a final state, alternating, for example, with animal birth. All good works can create religious merits (punya) that reduce karma. Believers expect such special merits from religious rites, fasting, pilgrimages or gifts to Brahmins as well as general charity (danam) and temple buildings.
Man is free and absolutely responsible for his own karma. But although karma means a law of "cause and effect", especially believers of the bhakti directions also trust in the unconditional grace of God, which can destroy the effect of karma and save man.
It is important to note that even a superficially "bad" deed can result in a good effect if the motives were pure and without self-interest. The approaches described belong to the point of view of "work activity" (pravritti): one does something in order to achieve a good effect. The opposite current is "non-action" (nivritti). Here the way is to withdraw from the world. The cause of the suffering state is said to be the thirst for life, i.e., the will to live; rebirth brings only a new transitory existence. By work one would be bound, but by knowledge (vidya) and non-action (nivritti) one would be redeemed. The ideal of equanimity is based on the renunciation of all actions aimed at success.
Both streams, pravritti (work-activity) and nivritti (non-activity), are represented in the Mahabharata and are mentioned in the Bhagavad Gita. In the Gita, Krishna gives preference to the yoga of action. This is the answer of Krishna to the corresponding question of Arjuna:
Perform the necessary work, for doing is better than doing nothing; even the actions of the body are based on an activity.
Every action that is not done out of sacrificial duty is bound to existence; therefore perform a work, but do not be attached to it.
(Bhagavad Gita 3. 8 - 9)