Q: I woke up to dampness on my body and clothing. Do I need to make ghusl?
A: In this scenario, which describes a nocturnal emission, there are two possible courses of action.
If you know that the dampness is maniy (orgasmic fluid), you are required to perform ghusl.
If you cannot tell if the dampness is maniy or madhiy (pre-orgasmic fluid) you are to proceed as follows.
A. If a cause of sensual desire such as a look at or thought of something stimulating, foreplay, or an erection was present before falling asleep, you are NOT required to make ghusl. What is obvious in this scenario is that the dampness is likely madhiy which would need to be washed from the body or clothing.
B. If there was NO cause of sensual desire before falling asleep, you are required to wash the soiled area on both the clothes and body as well as make ghusl. This is done as a precautionary measure from two angles; either it is maniy which requires ghusl or madhi which must be washed.
Source: Hidayat al-Raghib