Mediaeval people imagined that a devil could take the form of an Incubus. An incubus was a devil looking like a man who would seduce women, (they seduced men as well) especially when they were asleep. An incubus could be recognised because his penis stayed cold. Real sexual assaults might have been explained away by imagining that the attacker was an incubus. That way the attacker escaped punishment.