The word “Dharma” can be variously understood to mean religion, justice, law, ethics, divine order, and so forth.
In Vedic times, Dharma meant the practice of the fire ceremony and other kinds of rituals, which collectively upheld order in the universe.
In the later Vedic period (the Upaniṣads), Dharma increasingly conveyed the meaning of moral attitudes and behavior, or ethics.
The Vedas, sacred texts, are ultimately the origin of Dharma (or dharma), and they provide the divine justification for maintaining these rituals.