HEMPSTEAD, New York (CNN) - John McCain refused Wednesday to commit to nominating only judges who opposed abortion, saying he would "never impose a litmus test" on court nominees.
Watch: McCain and Obama on abortion
But he qualified the statement a moment later, saying he would base his nominations on "qualifications" - and that he did not believe a judge who supported Roe v. Wade, the case that legalized abortion, "would be part of those qualifications."
McCain hammered his Democratic opponent, Barack Obama, on abortion, accusing him of "aligning himself with the extreme aspect of the pro-abortion movement in America."
Obama rejected the charge out of hand, saying: "Nobody is pro-abortion."
He advocated sex education as a way of reducing the number of unintended pregnancies that result in abortions.
"We should try to prevent unintended pregnancies by providing appropriate education to our youth, communicating that sexuality is sacred and they should not be engaged in cavalier activity," he said.