Imam al-Shafi'i (may Allah have mercy on him) said: "(This) is because of the large number of people who come to him (the judge) for purposes other than those for which mosques were built."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب آداب القاضي / Q20262