A fatwa is a religious or legal verdict issued by a mufti or a scholar of Islam. A fatwa is primarily derived from the Quran and the authentic sayings or actions of the Prophet Muhammad (صلى الله عليه وسلم), otherwise known as Hadith. If there is not sufficient evidence from the above sources, then the opinions of previous scholars are taken into consideration, especially those who were well known for their knowledge and piety. The closer the scholar was to the time of Muhammad (صلى الله عليه وسلم), the more weight is given to his opinion.
Ibn al-Qayyim (رحمه الله) said:
The mufti or judge is not able to issue a fatwa or verdict without understanding two things:
(i) Understanding and having a good grasp of reality: he should have a good understanding of what is happening, on the basis of circumstantial evidence and other signs, so that he has a full understanding of it.
(ii) Understanding what is required in the light of these circumstances, which means understanding the ruling of Allah that He issued in His book or on the lips of His Messenger concerning this reality, then he should apply the one to the other.
I‘laam al-Muwaqqi‘een, 1/87