Mukhtar Masood, the writer of Awaz-e-Dost, Safar Naseeb, and Loh-e-Ayyam writes that north western part of Persia was called Media and it comprised of small regions in 350 B.C. Keqabad was ruler in one of the constituencies. He was famous for his fairness so much so that people from other districts used to bring their feuds to him. He used to hear the cases and decide notwithstanding where the parties belonged.
With time justice seekers from other counties grew and it had to be announced that only those cases will be decided in which parties involved were from areas directly under his command. Masses were so fed up from their own rulers that they declared Keqabad as a king of entire Media.
If the rulers are incapable of delivering justice, populace can chose new. The countries where justice is not mated out, natives may merge it with another.