In summary, we can define legality as the rational justification of submission and domination application. In fact, legality is based on 2 principles; the first is that on what basis a person or a group has the right to dominate on others and to issue compulsory commands? And the second one is that what principle does justify the requirement of public submission from the governmental commands?
Answer: In other words the Islamic authority is always in the follow of compulsory rules and commands and there is a rational relationship between "the right of authority" and "the need of submission".
Therefore, the two mentioned principles should cover both aspects and present a rational justification.
In theology and political jurisprudence, legality is defined as "rightfulness" and is applied in front of Usurpation. Thus, from this perspective, "legality" indicates who has the right to play authority on people on the basis of some standards and why the society should be submissive in front of the governors?
In Islamic perspective, the origin of legality comes from the authority and the authorization of God. In this vision, the instinct origin of legality is God, since he is the creator of the world and mankind, the owner of the entire universe, the only independent power and the governor of the entire world.
In Islam, the political authority is considered as a kind of invasion in the creatures' affairs which is itself one aspect of the Divinity. The element of unity in the Divine lordship does not reflect any origin in the creation and legislation system. The holy Quran states;
Sovereignty belongs only to Allah (Surat Yusuf: 40)
Have they taken guardians besides Him? It is Allah who is the Guardian (Surat al-Shura: 9)
Therefore, on the basis of rational principle, nobody has the authority right on social aspects of people unless he is selected from the God Almighty or on the basis of a credited legal reason, his being selected be proved (the divine authorization can be represented directly or indirectly from the prophets). Now, the most important question rolls over this statement that whether the pure God has transferred this right to others or not?
On the basis of many reasons, God has transferred this right to his prophets and other infallible Imams. The holy Quran talks about this reality in many of its verses; consider some of them:
The Prophet is closer to the faithful than their own soul (Surat al-Ahzab: 6)
Obey Allah and obey the Apostle and those vested with authority among you (Surat al-Nisa: 59)
It is also mentioned that the Twelvers Shiite believe in the appointment of the infallible Imams, on the basis of determined reasons. In addition to these Shiite authorities, they believe in the common appointment of well-qualified jurists who are appointed from the legislator or the deputy of Imam for the authority and political social leadership in the era of occultation. Although the same issue- Jurisdiction- does not relate to the occultation era, it can be achieved in the presence of Holy Imam, like the appointment of Malek Ashtar from the part of Imam Ali for governing Egypt.
Therefore, legality means the authority rightfulness which without the consideration of its achievement or not, originates from the divine authorization, and appointment. However, when the mentioned authority is not publicly accepted, it will not be able to apply the things related to social benefits, despite its having the legal right of authority.