Istihsan, usually translated juristic preference, is the doctrine that a qualified jurist may depart from the result a strict analogy would otherwise require when following it would produce an unjust or impractical outcome, replacing it with a ruling better supported by the deeper aims of the law. Mohammad Hashim Kamali's textbook on Islamic jurisprudence gives the classical Hanafi example: a contract for salam, paying in advance for goods to be delivered later, resembles by strict analogy the sale of something not yet in existence, which the law generally forbids as excessively uncertain. Hanafi jurists permitted it anyway by istihsan, reasoning that the practice was too useful and too well established among traders to prohibit on the strength of a formal resemblance alone, and that the terms of a salam contract could be specified precisely enough to remove the uncertainty the general prohibition exists to prevent. Wael Hallaq's history of shari'a describes istihsan as functioning, in Hanafi and Maliki practice, as a corrective built into the system rather than an exception to it, a recognized route from a rigid application of one textual analogy to a more equitable one grounded in the same body of law read as a whole.