Asim bin Damrah said: Sayyiduna Ali (may Allah be pleased with him) heard some people saying: "Judgment belongs to Allah alone." He said: Yes, that is so, but people must have a ruler, whether righteous or wicked, under whom the believer does his deeds and the disbeliever takes his enjoyment, and under whom Allah brings about His decree.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب قتال أهل البغي / 16764