(a) No person may perform or induce, or attempt to perform or induce, an abortion when it has been determined, by the physician performing or inducing or attempting to perform or induce the abortion or by another physician upon whose determination that physician relies, that the probable gestational age of the fetus has reached the pain capable gestational age, unless in the reasonable medical judgment of a reasonably prudent physician there exists a nonmedically viable fetus or the patient has a condition that, on the basis of a reasonably prudent physician's reasonable medical judgment, so complicates her medical condition as to necessitate the abortion of her pregnancy to avert her death or to avert serious risk of substantial and irreversible physical impairment of a major bodily function, not including psychological or emotional conditions. No condition may be deemed a medical emergency if based on a claim or diagnosis that the woman will engage in conduct which she intends to result in her death or in substantial and irreversible physical impairment of a major bodily function.
(b) When an abortion upon a patient whose fetus has been determined to have a probable gestational age that has reached the pain capable gestational age is not prohibited by subsection (a) of this section, the physician shall terminate the pregnancy in the manner which, in reasonable medical judgment, provides the best opportunity for the fetus to survive, unless, in reasonable medical judgment, termination of the pregnancy in that manner would pose a greater risk either of the death of the patient or of the substantial and irreversible physical impairment of a major bodily function of the patient than would other available methods.