A new law is set to be passed by the Scottish Parliament which will simplify the legal process for anyone in Scotland who wants to change their gender.
But the signs are that the UK government could refuse to recognise it, causing huge issues for people affected who want to relocate elsewhere in the UK.
Since 1998 some laws which apply in Scotland are made by MSPs in Edinburgh, while others are made by MPs at Westminster.
Legislation now in the Scottish Parliament will shorten the timescale for anyone who wants to obtain a gender recognition certificate, a document allowing someone to change their gender on their birth certificate.
Gender recognition certificates allow people to change certain legal documents, and can affect areas such as entitlement to benefits and pensions. The legislation is currently making its way through the Scottish Parliament and is likely to pass later this month.
But they may go further by refusing to recognise documentation issued under the new Scottish system in other parts of the UK. A UK government source close to the process told the BBC this was “absolutely” possible.
The Westminster government is also not ruling out the prospect of a legal challenge once the legislation is passed by MSPs – it believes the new law may have an impact on areas where policy is decided in London.
Asked if there could be a legal challenge to the Scottish legislation, the source told the BBC “nothing can be ruled out”.
Scottish government ministers have said they are happy to meet their UK counterparts to discuss their concerns – and officials in Edinburgh said they had tried to set up talks in October, without any response.
The SNP-led government believes the bill involves powers held solely in Edinburgh, so the UK government would not have grounds to mount a legal challenge.
Equalities Secretary Kemi Badenoch has written to the Scottish government expressing concerns about the Scottish legislation, and has offered to meet Scottish ministers to discuss it.
A UK government source told the BBC that they had concerns people from elsewhere in the UK may relocate to Scotland to change gender.
And they claimed Scottish ministers wanted to paint Scotland as a “haven of inclusivity” in comparison to a “nasty Westminster”.
The source described the Scottish legislation as a “test case scenario” of how a bill passed by the Scottish Parliament could “undermine Westminster competencies” – in other words, handing Holyrood powers outside Scotland.
A separate UK government official told the BBC there was “genuine concern” about the impact the legislation could have across the rest of the UK. They added that they hoped a legal battle could be avoided.
Scottish Social Justice Secretary Shona Robison has said she would be “happy to meet with Ms Badenoch” to discuss the issue.