LONDON (AP) — Scotland’s leader said Tuesday she will take the British government to court over its decision to block a Scottish law that makes it easier for people to change their gender on official documents.

First Minister Nicola Sturgeon said the Conservative U.K. government was making a “profound mistake” by vetoing the Gender Recognition Reform Bill passed by the Scottish parliament last month.

“It will inevitably end up in court,” Sturgeon told the BBC. “The Scottish government will vigorously defend this legislation.”

Hailed as a landmark by transgender rights activists, the bill would allow people age 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 would also cut 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 ages 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.

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

The British government used a rarely invoked power on Monday to block the law on the grounds that it could undermine U.K.-wide equality legislation that guarantees women and girls access to single-sex spaces such as changing rooms and shelters.

Opponents of the bill have argued that gender self-recognition could allow predatory men to gain access to spaces intended for women, a claim dismissed as scaremongering by supporters of the legislation.

Alister Jack, the U.K. government minister responsible for Scotland, said the government was concerned about “adverse effects” on “single-sex clubs, associations and schools, and protections such as equal pay.”

“The bill also risks creating significant complications from having two different gender recognition regimes in the U.K. and allowing more fraudulent or bad faith applications,” he told lawmakers.

Proof of how heated and divisive the issue can be came during a bad-tempered debate in the House of Commons on Tuesday. Conservative and Scottish National Party lawmakers traded jibes, and opposition Labour legislator Rosie Duffield was heckled by her own party colleagues after praising the government’s action.

The move puts the Conservative government in conflict with Sturgeon’s Scottish National Party-led administration, which wants Scotland to break away from the United Kingdom and become an independent country.

SNP lawmaker Joanna Cherry said on Twitter she opposed the bill “because it lacks adequate safeguards to protect the rights of women, girls & #LGB people. However, the problem is made in Scotland & should be fixed in Scotland.”

This is the first time a U.K. government has blocked a Scottish law since Scotland’s government and parliament were established a quarter-century ago as part of a process known as devolution. Sturgeon said the action was the start of a “very slippery slope of the U.K. government deciding to veto decisions of the Scottish parliament anytime you like.”

“A U.K. government wanting to undermine the Scottish parliament and choosing an issue where they think they can stoke some kind of culture war, and that’s what it is about,” she said. “And in doing that, they’re undermining devolution, they’re undermining Scottish democracy, but they’re also weaponizing a stigmatized, vulnerable, often marginalized group in our society.”

Jack denied the decision set a precedent. He said the veto power “can only be exercised on specific grounds, – and the fact that this is the first time it has been necessary to exercise the power in almost 25 years of devolution emphasizes that it is not a power to be used lightly.”

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.