The court’s statements seemed nonetheless to invite a new challenge to the law, and indicated that it could be successful.

Five of the seven justices in the Supreme Court said they had concluded that Northern Ireland’s abortion law violated the European convention by not allowing abortion in cases of fatal fetal abnormalities. The other two said they could not reach a conclusion on the matter.

Four of the seven justices said the law violated the European convention by not allowing abortion in cases of rape and incest.

Ireland was long seen as having some of the most restrictive abortion laws in the world — at least until the May 25 referendum. But Northern Ireland regulations permit the termination of a pregnancy only if a woman’s life is in danger. There are no other exceptions — not rape, not incest, not fatal fetal abnormalities — and those who violate the law could, in theory, be given a life sentence.

Britain legalized abortion in 1967, but that measure does not extend to Northern Ireland because of the ambiguous relationship between London and the so-called devolved administrations in Northern Ireland, Scotland and Wales, which exercise some individual powers but remain part of the unitary state of the United Kingdom.

But last year, after campaigning by the Labour Party, Westminster made a concession: It announced that the National Health Service would pay for abortions for Northern Irish women outside Northern Ireland. Currently, women who travel to England for the procedure — as about three do every day — have to pay privately for treatment.

The issue is politically problematic for Prime Minister Theresa May, whose Conservative Party is short of a majority of seats in Parliament. The Conservatives, who generally support abortion rights, are able to govern only with support from Northern Ireland’s socially conservative Democratic Unionist Party, whose leaders are on record as saying the North “should not be bullied into accepting abortion on demand.”