President Donald Trump has long vowed to nominate Supreme Court justices who would work to overturn Roe v. Wade, the landmark 1973 ruling that legalized abortion nationwide.

He now has his chance.

The retirement of Justice Anthony Kennedy, a swing vote who sometimes sided with his liberal colleagues on contentious social issues, sets up what is likely to be a bitter political fight over abortion heading into the fall midterm elections.

Abortion rights advocates issued dire warnings.

The "right to access abortion in this country is on the line," the Planned Parenthood Federation of America said. And Trump's pledge "should set off alarm bells for anyone who cares about women," said Nancy Northup, president of the Center for Reproductive Rights, a legal advocacy group.

Anti-abortion-rights groups, on the other hand, predicted a once-in-a-generation opportunity to reshape the ideological cast of the highest court in the land.

Kennedy's retirement "marks a pivotal moment for the fight to ensure every unborn child is welcomed and protected under the law," said Marjorie Dannenfelser, president of Susan B. Anthony List, whose political action committee backs anti-abortion-rights candidates.

What's unclear, however, is whether opponents of abortion rights would necessarily have the five votes they would need to overturn Roe, regardless of who succeeds Kennedy.

Clarence Thomas is the only sitting justice who has publicly declared opposition to the ruling, having joined the dissent in the court's 1992 landmark ruling in Planned Parenthood v. Casey, which upheld much of Roe. That dissent explicitly argued that Roe was "plainly wrong."

But many advocates and some legal scholars nonetheless predicted that the three other conservatives on the court — Chief Justice John Roberts, Samuel Alito and Neil Gorsuch — would likely join the new Trump-appointed justice in rulings that would target abortion rights and chip away at the protections of Roe.

"The addition of a new justice, one who will surely be very clear in his or her opposition to abortion ... certainly changes things," said Melissa Murray, a law professor and faculty director of the Center on Reproductive Rights and Justice at the University of California-Berkeley.

"There is no doubt the court will rethink its position on abortion," Murray said.

A decision to undo Roe wouldn't necessarily come immediately or without serious political repercussions, according to legal scholars and commentators.

A challenge to a state abortion law would need to wind its way through the judicial system and reach the Supreme Court before the conservative majority would even have a chance to overrule Roe. That could take years.

And it's not a given that, even with a strongly anti-abortion-rights newcomer, the court could muster a majority to strike down Roe. That's because Roberts has often declared his respect for "settled" court precedents, and "you can imagine that for the legitimacy of the court, the precedent would matter to him," Jeffrey Rosen, president of the National Constitution Center, a congressionally chartered education institute, said in an interview.

Roberts specifically addressed the entrenched nature of Roe twice in Senate confirmation hearings, first in 2003, when he was nominated to the U.S. Court of Appeals for Washington, D.C.

"Roe v. Wade is the settled law of the land," he said. "There's nothing in my personal views that would prevent me from fully and faithfully applying that precedent."

Then, in 2005 during his hearings to be chief justice, he reiterated that Roe was "settled as a precedent of the court, entitled to respect under principles of stare decisis" — Latin for "to stand by things decided."

The Center for Reproductive Rights contends that if Roe vs. Wade is overturned, the right to abortion is at the highest risk of loss in 24 states, which it says could ban abortion outright. Center for Reproductive Rights

Still, should the court choose to carve deeply into Roe, many states would quickly follow suit, the Center for Reproductive Rights contends.

"If Roe v. Wade is overturned, in 24 states, the right to abortion is at the highest risk of loss — these states could ban abortion outright," it said in an update this year of its "What If Roe Fell" analysis.

And the court wouldn't have to overturn Roe to dramatically erode access to legal abortion.

Over the years, many legal cases have sought to erode easy accessibility to abortion, rather than to strike down Roe. Kennedy often voted against such attacks, notably just two years ago in Whole Woman's Health v. Hellerstedt.

Kennedy joined a five-vote majority in finding that a Texas law imposed an "undue burden" on women by slapping building code requirements on clinics that provide abortion services and demanding that all physicians must have admitting privileges at a local hospital to provide abortions — a requirement that women's groups said would have forced more than three-quarters of the clinics in the vast, largely rural state to shut down.

Depending on when Kennedy's successor is confirmed, he or she could be faced with another partial challenge to abortion rights relatively soon.

In Iowa, the nation's most restrictive abortion law, banning most abortions once a fetal heartbeat is detected, had been scheduled to go into effect on July 1. That's on hold, however, because the law is already being challenged in the courts.