Qiyas is the process of legal deduction according to which the jurist, confronted with an unprecedented case, bases his or her argument on the logic used in the Qur’an and Sunnah. Qiyas must not be based on arbitrary judgment, but rather be firmly rooted in the primary sources.
Supporters of qiyas will often point to passages in the Qur’an that describe an application of a similar process by past Islamic communities. According to Hadith, Muhammad said: “Where there is no revealed injunction, I will judge amongst you according to reason.” Further, he extended the right to reason to others. Finally, qiyas is sanctioned by the ijma, or consensus, amongst Muhammad’s companions.
The success and expansion of Islam brought it into contact with different cultures, societies and traditions, such as those of Byzantines and Persians. With such contact, new problems emerged for Islamic law to tackle. Moreover, there was a significant distance between Medina, the Islamic capital, and the Muslims on the periphery on the Islamic state. Thus far off jurists had to find novel Islamic solutions without the close supervision of the hub of Islamic law (back in Medina). During the Umayyad dynasty, the concept of qiyas was abused by the rulers. The Abbasids, who succeeded the Ummayads defined it more strictly, in an attempt to apply it more consistently.
The general principle behind the process of qiyas is based on the understanding that every legal injunction guarantees a beneficial and welfare satisfying objective. Thus, if the cause of an injunction can be deduced from the primary sources, then analogical deduction can be applied to cases with similar causes. For example, wine is prohibited in Islam because of its intoxicating property. Thus qiyas leads to the conclusion that all intoxicants are forbidden.
The Hanafi school of thought very strongly supports qiyas. Imam Abu Hanifa, an important practitioner of qiyas, elevated qiyas to a position of great significance in Islamic law. Abu Hanifa extended the rigid principle of basing rulings on the Qur’an and Sunnah to incorporate opinion and exercise of free thought by jurists. In order to respond suitably to emerging problems, he based his judgments, like other jurists, on the explicit meanings of primary texts (the Qur’an and sunnah). But, he also considered the “spirit” of Islamic teachings, as well as the whether the ruling would be in the interest of the objectives of Islam. Such rulings were based on public interest and the welfare of the Muslim community.
The Shafi’i school of thought accepts qiyas as a valid source. Imam Shafi’i, however, considered it a weak source, and tried to limit the cases where jurists would need to resort to qiyas. He criticized and rejected analogical deductions that were not firmly rooted in the Qur’an and sunnah. According to Shafi’i, if analogical deductions were not strictly rooted in primary sources, they would have adverse effects. One such consequence could be variety of different rulings in the same subject. Such a situation, he argued, would undermine the predictability and uniformity of a sound legal system. 
Imam Malik accepted qiyas as a valid source of legislation. For him, if a parallel could be established between the effective cause of a law in the primary sources and a new case, then analogical deduction could be viable tool. Malik, however, went beyond his adherence to “strict analogy” and proposed pronouncements on the basis of what jurists considered was “public good