In Buddhist Vajrayana tradition, Mahakala is considered to be one of the dharmapala (tib. chos skyong) — protector of the Teaching. Boddhisatva Avalokiteshvara used this terrifying manifestation to protect Buddhism and practitioners.
Usually Mahakala depicted with the dark-blue or even black colors (in sanskrit kala means black or dark-blue) and shown in a very menacing way. There are 75 main forms of this deity.
In every form, Mahakala belongs to the group of enlightened beings and is not worldly protector of the Dharma. In the universe there are many different classes of beings and according to the tantric texts among all of them, there are 8 types of very powerful and negative creatures. One of it, the type called «mahakala», which can create a lot of hardship for people. So in order to control their harmful energy, Avolokiteshvara is manifesting in their dimension with their appearance.