Lead plaintiff Amy Hagstrom-Miller, left, president and chief executive of Whole Woman’s Health, and Nancy Northup, president and chief executive of the Center for Reproductive Rights, wave in celebration to supporters as they walk down the steps of the Supreme Court on Monday. (Kevin Lamarque/Reuters)

On Monday, the Supreme Court ruled on Whole Woman’s Health v. Hellerstedt. Abortion rights advocates challenged a Texas law that required abortion clinics to adhere to a set of regulations on doctors and facilities. The challengers argued the regulations were unnecessary and would close as many as half of the state’s existing abortion clinics.

In a 5-to-3 decision, the court agreed with the plaintiffs and invalidated the Texas law. That’s a different direction than the court has taken on abortion in recent years, as it upheld a series of laws that restricted abortion.

Why the shift?

Does the Supreme Court lean farther toward abortion rights when it has more female justices?

In their coverage of oral arguments in the case, Lyle Denniston at Scotusblog, Dahlia Lithwick at Slate and Nina Totenberg of NPR all pointed out that the three female justices — Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan — were exceptionally forceful in their questioning of the Texas solicitor general, who was defending the state’s regulations. Could this shift toward the pro-choice side have something to do with the fact that, unlike in any abortion case before now, three of the justices on the court are women?

I don’t think so. Gender is certainly an appealing explanation. But party, ideology and Supreme Court institutional norms matter more.

At first glance, there seems to be a strong connection between the presence of women on the court and decisions favoring women’s constitutional right to an abortion in the post-Roe v. Wade era. For instance, in 1992, Justice Sandra Day O’Connor joined with Justices Anthony Kennedy and David Souter to author the opinion in Planned Parenthood v. Casey. That opinion preserved the core holding of Roe, after many had predicted the court — then composed of a majority of Republican appointees — would overrule it.

Then there are the two cases dealing with bans on late-term abortions, known as “partial birth” abortion laws. Sixteen years ago, in the last pro-abortion-rights ruling before Monday’s decision, the Supreme Court struck down a Nebraska law that lacked an exception for abortions necessary for a woman’s health. In that case, Stenberg v. Carhart, both O’Connor and Ginsburg were in the 5-to-4 majority. Seven years later, after O’Connor had left the court and had been replaced by Justice Samuel Alito, the court heard Gonzales v. Carhart, a challenge to the federal Partial Birth Abortion Ban Act. This time the court upheld the law. Ginsburg, then the sole woman on the court, wrote a blistering dissent.

These examples don’t necessarily answer the question of whether having women makes a difference in outcomes. Figuring out whether gender is responsible for voting differences among judges is notoriously tricky, in large part because it is hard to separate out gender from party.

Ideally, we need large numbers of women, appointed by presidents of both parties, to compare with male justices also appointed by both parties.

But there have been only four women appointed in the court’s entire history, and Democratic presidents appointed three of the four. If Ginsburg casts a pro-abortion-rights vote, is that because she’s a woman … or because she’s a Democrat? After all, the majority opinion in the Texas case was written by Justice Stephen Breyer, who, like Ginsburg, was a Bill Clinton appointee.

In general, U.S. women and men have pretty similar views on abortion

Should we even expect male and female justices to hold different views about abortion? Public opinion research suggests probably not. A 2016 Pew Research survey found that women and men hold fairly similar views toward abortion, with 55 percent of women and 57 percent of men saying that abortion should be legal in most or all cases. Similarly, research on federal appellate judges fails to find significant differences between male and female judges on the issue of abortion.

In contrast, there are significant differences between male and female judges’ voting behavior in employment discrimination law. Women are more likely to support claims of sex discrimination.

My own research with Susan Haire into the U.S. Courts of Appeals finds that these gender differences are primarily due to the voting behavior of women of Ginsburg’s generation. But such “trailblazer” women probably vote differently because of their personal experiences with overt and pervasive discrimination; that doesn’t necessarily hold up with all women or for all issues.

Gender doesn’t predict a judge’s views on abortion. Party and ideology do.

Consider the fact that in Whole Woman’s Health v. Hellerstedt, three of the lower court judges who upheld the law in earlier phases of the case are women: Jennifer Elrod, Catharina Haynes and Edith Jones. All three are Republican appointees. Because of the importance of abortion as an issue for both political parties, it’s not surprising that those who are confirmed to the federal judiciary largely reflect their party’s stance on abortion.

Ideology matters, too. The Pew study found that only 30 percent of Republicans who identify as conservative support abortion in most or all circumstances, while 54 percent of moderate and liberal-identifying Republicans thought that abortion should be legal most or all of the time.

This helps to explain O’Connor, who voted on both sides of the abortion issue. For example, in the 1989 case Webster v. Reproductive Health Services, O’Connor voted with the majority to uphold a Missouri law that restricted public funding for abortion. In spite of the fact that O’Connor was appointed by a Republican president, her voting record, as measured by the Martin-Quinn ideology scores, places her as a moderate on the court — particularly in comparison to her replacement, Alito, who is considerably more conservative.

So what’s the future of Supreme Court abortion decisions?

Ginsburg, Sotomayor and Kagan have positioned themselves as forceful advocates for abortion rights, but they still have to operate within the constraints of the court. Given the current eight-person panel, they can only guide doctrine if the four Democrats on the court can persuade Kennedy, a Reagan appointee, to join them for a fifth vote, as he did in this case.

However, Kennedy’s record on abortion has supported abortion restrictions more often than abortion rights. It’s possible that the tough questions asked by the three female justices at oral argument helped to make up Kennedy’s mind. Or he may simply have decided that he could not adopt the position taken by the three other Republican appointees: Chief Justice John Roberts, Justice Clarence Thomas and Alito.

Kennedy, as the most senior justice in the majority in the Texas case, got to decide who wrote the opinion — and it may be significant that he assigned it not to one of the three female justices (or to himself), but to Breyer, a more moderate Democrat. While research shows that justices do negotiate over the content of the majority opinion, in close cases like this, the opinion author generally tries to appease justices who are on the fence. Breyer’s opinion did just that.

In sum, for future Supreme Court jurisprudence on abortion, the biggest question is which party wins the November election — and gets to fill the empty seat on the Supreme Court bench. If Hillary Clinton wins and faces a favorable Senate, the court is likely to become more liberal on abortion rights, whether the new justice is a man or a woman.

Laura Moyer is associate professor of political science at the University of Louisville and, along with Susan Haire, is the author of “Diversity Matters: Judicial Policy Making in the U.S. Courts of Appeals.”