As to masturbation, there can be various spirits that cause it: Lust, Masturbation, Fornication (mental thoughts of this while masturbating), etc., etc., etc. It isn’t always a demonic conflict behind it, either, though. It can just be from our sin nature. Is all masturbation sin? It is hard for a person to not have sinful thoughts while masturbating, and that is adultery for Jesus says to look at (or think about) a woman and lust (has mental sex) is the same as adultery. Its hard for me to picture Jesus doing that, so I do believe it is sin when one does it to themselves. For a mate to do it to a mate, if it is agreeable and pleasurable for both, then that is OK. Should masturbation be OK because it is better than adultery? We can’t justify one sin by saying it prevents a ‘worse’ sin, for sin is sin. Paul does say to the Corinthians
1 Cor 7:8-9 “Now to the unmarried and the widows I say: It is good for them to stay unmarried, as I am. But if they cannot control themselves, they should marry, for it is better to marry than to burn with passion. “ He doesn’t give masturbation as an alternative. Just getting married in order to have ‘legal’ sex isn’t; right either, though. I Cor 10:13 says God doesn’t give us more than we can bear and that He always provides a way out of the temptation/sin. I hope that helps. If you have any other questions let me know.