masturbation.. but religious??

i used to masturbate because i thought he would keep me from wanting to have sex. a couple weeks ago i had a pregnancy scare (still going through one) and stopped sexual acts all together. so tell me, do you think that masturbation is a sin?