It is mentioned in a Hadith that there is a valley in hell which seeks refuge four hundred times daily. The proud and haughty ulama will be entered into it. (Mishkaat) This refers to that aalim who renders religious services in order to show people. He acquires and imparts knowledge so that people may regard him as an aalim, respect him, give him money and regard him as a pious person. To offer acts of worship in order to show anyone other than Allah is a major sin and is also a form of shirk (ascribing partners to Allah).