There is an important distinction between leadership as a goal and leadership as a means to another goal. The messengers were all given leadership as a means of influencing people towards righteousness. A just ruler enables society to be filled with righteousness and justice.
Sh. Omar Suleiman describes the circumstances in which to seek positions of leadership.