LONDON — The UK Supreme Court has delivered a major ruling allowing a lawsuit against Bahrain over alleged spyware attacks on two dissidents living in Britain to proceed.

The court rejected Bahrain's attempt to rely on state immunity, ruling by a narrow three-to-two majority that alleged remote surveillance of computers located in the UK could fall within an exception to immunity under British law.

The case was brought by Saeed Shehabi and Moosa Mohammed, who allege that their computers were infected with FinSpy spyware around 2011. They claim the alleged surveillance caused psychological harm and are seeking damages. Bahrain denies the hacking allegations.

The ruling could have wider consequences for digital surveillance and international accountability in Britain. Legal experts say the decision may make it easier for people in the UK to pursue civil claims against foreign states over alleged cyber operations carried out remotely from overseas.

The case will now return to the High Court, where the underlying allegations can continue to be considered. The Supreme Court's decision does not itself establish that Bahrain carried out the alleged hacking.

The judgment has also triggered debate over the relationship between UK law, state immunity and international relations, with one dissenting judge warning that the decision could create international-law concerns.