WITH a wince, Theresa May said she was sorry. Asked about her record on gay rights, the prime minister apologised for refusing to support the repeal in 2003 of a law which banned teaching children “the acceptability of homosexuality as a pretended family relationship”. A year earlier she had voted against adoption by gay couples. Yet today, “I want to be seen as an ally of the LGBT community,” said the prime minister. “We want a country where people are able to be open about who they are, who they love and how they identify.” The Conservative Party, once a generator of anti-LGBT laws, has belatedly wrapped itself in the rainbow flag.

Mrs May was speaking at the launch of a consultation on reforming the Gender Recognition Act, which dictates how people can change their legal gender. Supporters of reform argue that the current system is slow and demeaning. To obtain a Gender Recognition Certificate, a person must have spent two years in their new gender. They need a doctor’s diagnosis of gender dysphoria, must submit medical reports, sign a legal undertaking and pay £140 ($185). Only 4,910 people have bothered since 2004, when the law came into force.

The government wants the process to be “streamlined and de-medicalised”. Beyond that, details are thin. But the destination is clear: a looser regime. “Trans women are women; trans men are men,” Penny Mordaunt, the minister in charge, told Parliament. Labour supports the plan to liberalise the law, criticising only the government’s sluggishness.

Normally, unanimity in the House of Commons is reserved for uncontroversial topics. This time, Labour and the Tories have ended up on the same side of a brewing culture war. The consultation exercise has provoked complaints that women-only spaces, from toilets to domestic-abuse shelters, could become vulnerable to sexual predators if rules are loosened too much. Supporters of reform argue that single-sex spaces are protected by the Equality Act, and that trans people could still be excluded if necessary. The consultation will examine whether changing rules on gender recognition would affect these protections.

The row is bitter. Insults fly online. One offline debate ended in assault. Women wearing fake beards invaded the men’s bathing pond at Hampstead Heath, to protest against trans women’s use of the ladies’ pond. Arguments have erupted over changing rooms, all-women MP shortlists and even the cabin arrangements of the Caledonian Sleeper train.

The viciousness stems partly from a difference between trans rights and other social-justice movements. Most of the opposition to changing the law has not come from the authorities, as in the gay-rights movement. Instead, the main struggle is with women, who argue that their own interests are jeopardised by the reforms.

That the government has waded into such a controversial area has left some MPs perplexed. For most voters, trans rights fall low on the agenda. Data are poor, but by the government’s rough estimate 200,000-500,000 trans people live in Britain. “Most people now know a gay person,” says Benjamin Cohen, chief executive of Pink News, a website. “But almost no one knows any trans people.”

The Tories, however, are keen to atone for their past mistakes on LGBT rights, and to shake off an illiberal reputation. At last year’s election the party lost support in metropolitan areas, undoing a decade of patient work by David Cameron to woo socially liberal voters. Enacting gay marriage was one of the main achievements of his six years in office. Some Conservative MPs suggest that improving the lot of trans people would win back lost votes.

Yet it is not clear that the policy will be a vote-winner. A poll by YouGov, commissioned by Pink News, found that only 18% thought that people should be allowed to change their legal gender without a doctor’s approval. Among Tory voters the figure was 13%. When Mr Cameron pushed for equal marriage, a clear majority of people in Britain (if not the Conservative Party) supported it. “With gay marriage, politicians responded to public opinion,” says one former Downing Street staffer. “Here, it feels the opposite.”

Labour is in a similar position. Though the party backs looser rules on gender recognition, 54% of Labour voters believe it should require a doctor’s approval. Muslim voters, in particular, most of whom back Labour, may be put off by the party’s liberal approach to trans issues, worries one aide. The topic is divisive among the party’s rank and file. Len McCluskey, the boss of the powerful Unite union, signed a letter accusing violent trans-rights activists of bringing “our progressive movement into disrepute”. In turn, this letter attracted protest from some younger party members, for whom trans rights are totemic.

The wider public may yet change its attitude, as it did on gay rights. Fully 82% say they are “not prejudiced at all” to transgender people, according to NatCen Social Research. Yet only 41% say qualified trans people should definitely be allowed to work as primary school teachers. Unlike with past social movements, if change is to come it will be from the top down. Mrs May will be hoping that the public will alter its view, just as she altered hers.