With the fate of Roe v. Wade hanging in the balance after the confirmation of Supreme Court Justice Brett M. Kavanaugh, Tuesday’s midterm elections brought high stakes for both sides of the abortion debate.

And while antiabortion advocates gained clear legislative victories in Alabama and West Virginia, at least seven state legislative chambers flipped to Democratic, pro-abortion-rights majorities, in Colorado, Connecticut, Minnesota, Maine, New York and two in New Hampshire.

Why should we be paying attention to the role of these state-level races in the abortion debate? If the Supreme Court overturns Roe, state lawmakers and governors could have the power to enact major changes in access to abortion.

“For decades, states have been the battleground on abortion rights,” said Elizabeth Nash, a policy analyst at the Guttmacher Institute, an advocacy group focusing on reproductive-health policy. “If the Supreme Court rolls back abortion rights, states will have even more leeway to undermine abortion rights.”

Where antiabortion activists won

In Alabama and West Virginia voters passed constitutional amendments paving the way to ban abortion if the new conservative consensus on the Supreme Court overturns the landmark 1973 ruling that outlawed restrictions on the procedure before the fetus is viable.

In West Virginia, voters passed a measure amending the state’s constitution to say that “nothing in this Constitution secures or protects a right to abortion or the funding of abortion.” It also banned state Medicaid insurance from covering abortion. In Alabama, a ballot measure passed assigning legal rights to fetuses and excluding the right to abortion from the state constitution.

Fifty-eight percent of voters in Alabama voted for the ballot measure, and the vote was tighter in West Virginia — about 52 percent to 48 percent in favor.

Abortion rights activists touted wins for Democratic gubernatorial candidates in Kansas, Wisconsin, Michigan and Minnesota, too.

In Kansas, Sam Brownback as governor had signed into law sharp restrictions on abortion, and Republican gubernatorial candidate Kris Kobach had vowed to support a state constitutional amendment making clear that the right to an abortion is not provided in Kansas. On Tuesday night, Laura Kelly, a Democrat endorsed by Planned Parenthood, was elected governor.

In Wisconsin, where Gov. Scott Walker’s cuts to Planned Parenthood funding caused five health centers to close, voters elected Tony Evers as governor.

Still, antiabortion advocates touted strong wins in the U.S. Senate, where three Republican candidates who describe themselves as strong opponents of abortion flipped seats in Missouri, North Dakota and Indiana.

According to the National Review, the antiabortion Susan B. Anthony List spent nearly $30 million this election cycle to support antiabortion GOP senators. Talking about abortion more and more explicitly has been a winning strategy for some in the GOP in the past few years, the conservative news site reported this week, despite mainstream GOP advice to steer a middle course.

Where abortion rights activists won

But in Oregon, a ballot measure prohibiting the use of public money to fund most abortions was defeated, rejected by 64 percent of voters. And for abortion rights activists, such as Planned Parenthood, these ballot measures were anomalies in an otherwise promising night that brought Democratic wins in gubernatorial and state legislature races across the country.

“Far more elected officials today than yesterday are going to be working to protect access to abortion and reproductive health in this country,” said Dawn Laguens, the executive vice president and chief experience officer for Planned Parenthood Action Fund.

If the clock was ticking toward midnight after Kavanaugh’s confirmation to the Supreme Court, Laguens said, “unequivocally it ticked away from midnight” on Tuesday night.

Planned Parenthood counted at least seven state legislative chambers that flipped to Democratic, pro-abortion-rights majorities, in Colorado, Connecticut, Minnesota, Maine, New York and two in New Hampshire. And several key toss-up states elected Democratic governors, dodging Republican candidates who had threatened to restrict access to abortion.

How religion played in

Abortion rights advocates say there is evidence this year that religious conservatives are treating the topic of abortion a little more critically in deciding how to vote. The ballot measures in West Virginia and Alabama passed with narrow margins, they said. And some religious voters appear to be weighing abortion against other issues, such as immigration, in determining what qualifies as pro-life, possibly adding to the wins of Democrats to national offices in conservative areas such as Kansas and Oklahoma.

“I think the religious community is becoming more sophisticated in the wide range of what it means to be ‘for life,’ " said Doug Pagitt, a co-founder of the progressive Christian advocacy group Vote Common Good.

About a quarter of voters were Catholic, according to network exit polling done by CNN. Of that group, the vote was split: 50 percent voted for House Democrats and 49 percent for Republicans. In 2014, they supported Republicans by nine points, 54 percent to 45 percent.

Among the 2 percent of voters who are Jewish, 79 percent voted for Democrats compared with 17 percent for Republicans, wider than the 66 percent to 33 percent margin in favor of Democrats in 2014.

Using the religiosity metric of worship service attendance, voters who go to services weekly or more frequently supported Republican House candidates 58 percent to 40 percent, the same as 2014.

This year saw left-leaning voters, including ones who are religious, pay attention anew to the topic of abortion. A recent Pew Research Center poll said 61 percent of Democrats said abortion was “very important” to their vote this year, up from 38 percent in 2008. Forty-four percent of GOP voters told Pew abortion was “very important.”

Meanwhile, white evangelicals — who are now the most strongly opposed to abortion access — voted generally as they have in past elections. According to CNN’s exit polls, they made up about a quarter of House voters. In those races, they voted for GOP candidates by 75 percent to 22 percent. In 2014, they went for the GOP by a similar 78 percent to 20 percent.

Tim Head, executive director of the Faith & Freedom Coalition, a conservative Christian advocacy group, said the fact that evangelical Christians continue to make up such a big slice of the electorate — 26 percent, as they did in the 2014 midterms, according to CNN exit polls — is testimony to the drive to fight abortion because the topic is such a high priority for those voters.

There was anecdotal evidence that conservative voters were motivated to come to the polls by the fight over Kavanaugh, he said, which was a dispute largely about abortion.

“When you talk the Supreme Court, the number one issue about the Supreme Court for evangelicals is the life question,” Head said. “It remains on the boiler at all times.”

The Lily live-painted a mural to reflect this year’s record number of first-time female candidates. See it here.

On election night, we painted in feathers of an eagle to represent the winners

What Kyrsten Sinema’s win as the first openly bisexual U.S. senator means for politics

The LGBTQ community’s midterm victories were a rejection of Trump

Krysten Sinema wins in Arizona to become the state’s first female senator

Democrats have captured a longtime GOP Senate seat with her win