LONDON (Reuters) - A complex legal dispute involving a transgender woman’s pension rights over a period when her gender had not been officially recognized has divided Britain’s Supreme Court, which referred the issue on Wednesday to the European Union’s top court.

Britain voted to leave the EU in a referendum on June 23, but the terms of its exit will take years to negotiate and in the meantime it continues to be subject to EU law.

The impact of EU legislation on domestic law was one of the topics of debate in the run-up to the referendum. Pro-Brexit campaigners argued that unaccountable EU judges were chipping away at British sovereignty, while their opponents said EU laws were sensible and had improved human rights protection.

The Supreme Court made it clear it required EU guidance to resolve the case of a woman, named only as “MB” in court documents, who was registered as a boy at birth but has lived as a woman since 1991 and had gender reassignment surgery in 1995.

MB turned 60 in 2008 and applied for a state pension, which under British law women born before 1950 are entitled to from that age. Men born before 1953 become entitled at the age of 65.

MB was turned down because she did not have a full gender recognition certificate, an official document she could not obtain because she remained married to a woman. At the time, same-sex marriage was not legal in Britain.

The case echoes a number of legal disputes in the United States over complex issues involving transgender people, including a dispute over bathroom rights that has reached the U.S. Supreme Court and received extensive media coverage.

In Britain, the laws affecting MB’s circumstances have since changed. Same-sex marriage became legal in 2014 and a full gender recognition certificate can now be given to a married transgender applicant with the consent of their spouse.

But that did not change MB’s situation and she was told she could not be treated as a woman for state pension purposes and would only become eligible when she turned 65.

MB took legal action against the government, arguing that its approach to her case breached an EU directive on the equal treatment of men and women in matters of social security.

Article 4 of that directive says there must be no discrimination on ground of gender either directly, or indirectly by reference to marital or family status.

The case went all the way to the Supreme Court, which said it needed help from the Luxembourg-based Court of Justice of the European Union on how to interpret the directive.

“The Supreme Court is divided on the question, and in the absence of Court of Justice authority directly in point, considers that it cannot finally resolve the appeal without a reference to the Court of Justice,” it said in a ruling.