§ 130.10 Sex offenses; limitation; defenses. 1. In any prosecution under this article in which the victim's lack of consent is based solely upon his or her incapacity to consent because he or she was mentally disabled, mentally incapacitated or physically helpless, it is an affirmative defense that the defendant, at the time he or she engaged in the conduct constituting the offense, did not know of the facts or conditions responsible for such incapacity to consent. 2. Conduct performed for a valid medical or mental health care purpose shall not constitute a violation of any section of this article in which incapacity to consent is based on the circumstances set forth in paragraph (h) of subdivision three of section 130.05 of this article. 3. In any prosecution for the crime of rape in the third degree as defined in section 130.25, criminal sexual act in the third degree as defined in section 130.40, aggravated sexual abuse in the fourth degree as defined in section 130.65-a, or sexual abuse in the third degree as defined in section 130.55 in which incapacity to consent is based on the circumstances set forth in paragraph (h) of subdivision three of section 130.05 of this article it shall be an affirmative defense that the client or patient consented to such conduct charged after having been expressly advised by the health care or mental health care provider that such conduct was not performed for a valid medical purpose. 4. In any prosecution under this article in which the victim's lack of consent is based solely on his or her incapacity to consent because he or she was less than seventeen years old, mentally disabled, a client or patient and the actor is a health care provider, detained or otherwise in custody of law enforcement under the circumstances described in paragraph (j) of subdivision three of section 130.05 of this article, or committed to the care and custody or supervision of the state department of corrections and community supervision or a hospital and the actor is an employee, it shall be a defense that the defendant was married to the victim as defined in subdivision four of section 130.00 of this article.