LONDON -- The British government said Monday it will block a new law that makes it easier for people in Scotland to legally change their gender, sparking conflict with transgender rights advocates and the nationalist Scottish administration in Edinburgh.

Secretary of State for Scotland Alister Jack said he would prevent the bill from getting royal assent — the final formality that makes it law — because of concern it conflicts with “Great Britain-wide equalities legislation.†That legislation, among other things, guarantees women and girls access to single-sex spaces such as changing rooms and shelters.

The Scottish government is likely to challenge the decision at the U.K. Supreme Court.

Scottish First Minister Nicola Sturgeon called the decision by Prime Minister Rishi Sunak’s Conservative government “a full-frontal attack†on the Scottish parliament, which approved the bill last month.

“The Scottish Government will defend the legislation and stand up for Scotland’s Parliament,†she said on Twitter. “If this Westminster veto succeeds, it will be first of many.â€

The Scottish bill allows people aged 16 or older in Scotland to change the gender designation on their identity documents by self-declaration, removing the need for a medical diagnosis of gender dysphoria.

It also cuts the time trans people must live in a different expressed gender before the change is legally recognized, from two years to three months for adults and to six months for people aged 16 and 17.

The legislation sets Scotland apart from the rest of the United Kingdom, where a medical diagnosis is needed before individuals can transition for legal purposes.

The Scottish National Party-led government in Edinburgh says the legal change will improve the lives of transgender people by allowing them to get official documents that correspond with their gender identities.

Opponents claim it risks allowing predatory men to gain access to spaces intended for women, such as shelters for domestic abuse survivors. Others argue that the minimum age for transitioning should remain at 18.

Scotland is part of the United Kingdom but, like Wales and Northern Ireland, has its own semi-autonomous government with broad powers over areas including health care.

This is the first time a U.K. government has blocked a Scottish law since the Scottish government and parliament were established a quarter century ago. The move will provide fodder for nationalists who want Scotland to break away from the U.K. and become an independent country.

Jack, the U.K. minister responsible for Scotland, said he had “not taken this decision lightly.â€

“Transgender people who are going through the process to change their legal sex deserve our respect, support and understanding,†he said in a letter to Sturgeon. “My decision today is about the legislation’s consequences for the operation of GB-wide equalities protections.â€

Shami Chakrabarti, a Labour Party member of the House of Lords and former director of the rights group Liberty, said Sunak’s government might be trying to stir up “culture wars†by stepping in, but legally “they may have a point.â€

“It is arguable, at least, that what’s happened in Scotland has a potential impact on the legislation as it operates U.K.-wide,†she told the BBC.

Several countries around the world have legalized gender self-recognition, including Argentina, Canada, New Zealand, Denmark and Iceland. Last month Spain’s parliament approved a bill similar to Scotland’s.