In the 31 planes of existence, I heard that most of the hell officers are yakkhas,one of a subcategory of god of Catumaharajika, the lowest deva realm. They are the ones who punished those who are reborn in hell due to their bad kamma that they have committed. They whip, beat, push those beings into hot pot of oil, etc. Are they creating bad kamma by doing so? How about the Lord of the Underworld, Yama, who gives sentences to those beings? Is he committing bad kamma as well? What gives him the authority to sentence those beings?
Thanks in advance for your clarification.
A little on Yama:
The god of death. (See, e.g., DhA.iii.337; Yamassa santikam = Maranasantikam).
When beings die they are led before him to be judged according to their deeds. Birth, old age, illness, punishment for crime and death, are regarded as his messengers, sent among men as a warning to abstain from ill and do good. Yama questions beings brought before him as to whether they have seen these messengers and profited by them. If the answer is in the negative, the nirayapālas take them away to the different hells (M.iii.179ff).
In the Mahāsamaya Sutta (D.ii.259) mention is made of two Yamas (duve Yamā), which the Commentary explains (DA.ii.690) by "dve Yamakadevatā" (the twins, whom Rhys Davids calls the Castor and Pollux of Indian Mythology, in Dial.ii.290, n.1).
Elsewhere (AA.i.374; MA.ii.953) Buddhaghosa speaks of four Yamas (im c' esa eko va hoti, catusu pana dvāresu cattāro janā honti) at the four gates (of the Nirayas?). He says that Yama is a Vemānikapetarājā, who sometimes enjoys all the pleasures of heaven, in a celestial mansion, surrounded by kapparukkhas, and at other times experiences the fruits of his kamma. He is a good king.
In the Jātakas* the Nirayas are particularly mentioned as Yama's abode (Yamakkhaya, Yamanivesana, Yamasādana, etc.); but, more generally, all Samsāra is considered as subject to Yama's rule, and escape from samsāra means escape from Yama's influence, Yama being the god of Death. It is evidently in this sense that Yama is called Vesāyi (q.v.) (J.ii.317, 318).
Yama is sometimes mentioned** with Indra, Varuna, Soma, Pajāpati, etc., as a god to whom sacrifices are offered. There is a tradition (A.i.142) that once Yama longed to be born as a human being and to sit at the feet of a Tathāgata.
Yama's Nayanāyudha is mentioned (SNA.i.225) among the most destructive of weapons.http://www.palikanon.com/english/pali_names/y/yama.htmYāma
1. Yāmā. A class of Devas, mentioned in lists of devas between those of Tāvatimsa and those of Tusita
(E.g., Vin.i.12, A.i.228; iii.287; M.ii.194; iii.100, etc.).
Two hundred years of human life are but one day to the Yāma devā, and two thousand Years, composed of such days, form their life period (A.i.213; iv.253). Sirimā, sister of Jīvaka, was born after death in the Yāma world and became the wife of Suyāma, king of Yāmabhavana. From there she visited the Buddha with five hundred others. SNA i.244f.; see also VvA.246 for an upāsaka born in the Yāma-world.
In the Hatthipāla Jātaka (J.iv.475) mention is made of four Yāma-devas who were reborn as men.
The meaning of Yāmā is explained in the Commentaries (E.g., VibhA.519; PSA.441) as "those that have attained divine bliss" (dibbam sukham yātā payātā sampattā ti Yāmā). Other explanations are “misery freed" or "governing gods”. Compendium, p.138, n.2.
2. Yāmā. In some contexts, Yāmā seems to have been derived from Yama, king of the underworld - e.g in such expressions as "Yāmato yāva Akanittham" (From the underworld to the highest heaven). KhA.166.http://www.palikanon.com/english/pali_n ... yaamaa.htm