Abortions have declined in states where new laws make it harder to have them — but they have also waned in states where abortion rights are protected, an Associated Press survey shows. Nearly everywhere, in red states and blue, the number of abortions is down since 2010.

Explanations vary. Abortion rights advocates attribute it to expanded access to effective contraceptives and a drop in unintended pregnancies. Some abortion opponents say there has been a shift in societal attitudes, with more women choosing to carry their pregnancies to term.

Several of the states that have been the most aggressive in passing antiabortion laws — including Indiana, Missouri, Ohio and Oklahoma — have seen their abortion numbers drop by more than 15 percent since 2010. But more liberal states such as New York, Oregon and Washington also had declines of that magnitude, even as they maintained unrestricted access to abortion.

Nationwide, the survey showed a decrease in abortions of about 12 percent since 2010.

One major factor has been a decline in the teen pregnancy rate, which in 2010 reached its lowest level in decades. There has been no official update since then, but the teen birthrate has continued to drop, which experts say signals a similar trend for teen pregnancies.

The Associated Press obtained the most recent abortion numbers from the health departments of all 45 states that compile such data on a comprehensive basis. (States not compiling such data are California, Maryland, New Hampshire, New Jersey and Wyoming.) With one exception, the data was from 2013 or 2014 — providing a nationwide gauge of abortion trends during a wave of antiabortion laws that gathered strength starting in 2011.

Among the groups most active in promoting the restrictive laws is Americans United for Life. Its president, Charmaine Yoest, suggested that the broad decrease in abortions reflected a change in attitudes among pregnant women.

“There’s an entire generation of women who saw a sonogram as their first baby picture,” she said. “There’s an increased awareness of the humanity of the baby before it is born.”

But advocates for abortion rights said the figures demonstrate that restrictive laws are not needed to significantly reduce the number of abortions. That can be achieved, they said, by helping more women obtain affordable, effective contraception including long-lastingoptions such as intrauterine devices (IUDs) and hormonal implants.

Elizabeth Nash, a state-issues expert for the Guttmacher Institute, a research group that supports abortion rights, said 267 abortion restrictions have been enacted in 31 states since 2011.

— Associated Press