Generally mal is used as an adverb, but it can also be an invariable adjectif (yes it is confusing...) ->
Il est (au plus) mal = can mean he is sick or dying or in a dangerous situation or in dire straits etc...
It is also used instead of mauvais in the expressions : bon an mal an / bon gré mal gré
It can also be a noun : le bien et le mal (good and evil, in this case mal=evil).