Mexico City’s regional congress approved a bill to criminalise gay ‘conversion therapy’ in a virtual session on Friday 24 July.

The practice – which has been discredited by the NHS and the World Psychiatric Association – refers to any attempt at changing a person’s sexual orientation or gender identity and often involves techniques such as electroshock therapy or prayer.

The new law, hailed as a major step forward for LGBTQ+ citizens in Mexico, would sentence offenders with up to five years in prison and there would be harsher punishments for those who subject minors to the practice.

It also defines ‘conversion therapy’ as a psychological or psychiatric measure that intends to “nullify, hinder, modify or undermine” the expression of a person’s gender identity or their sexual orientation.

LGBTQ+ activists praised the outcome on social media, with Jóvenes LGBT México writing on Twitter: “Today, one more fight has been consolidated in our city and so has one more chapter in the history of the LGBT+ movement in Mexico. I feel very happy to walk hand in hand with all of you. This victory is yours.”

Mexico City’s ban on ‘conversion therapy’ follows recent calls for Boris Johnson to criminalise the practice in the UK.

Ban Conversion Therapy, a new group which works closely with LGBTQ+ charities and human rights organisations, are calling for a comprehensive and swift ban.

An open letter to the prime minister and Downing Street has also attracted the support of numerous celebrities.

The letter, backed by Elton John, Stephen Fry, Dua Lipa, Little Mix’s Jade Thirlwall, Stonewall, Mermaids, The Ozanne Foundation, Amnesty UK, Gendered Intelligence, All-Out and many others was sent to Downing Street and Equalities Minister, Liz Truss, on 10 July.

Other signatures include Olly Alexander from Years & Years, trans activist Munroe Bergdorf, screenwriter Dustin Lance Black, actor Alan Cumming, writer Russell T. Davies, comedian Mae Martin, Liberal Democrat leadership contender Layla Moran, co-founder of UK Black Pride Phyll Opoku-Gyimah and singers Rina Sawayama and Charli XCX.

Social media giant Instagram has also pledged to ban all content relating to the promotion of ‘conversion therapy.’

“We don’t allow attacks against people based on sexual orientation or gender identity and are updating our policies to ban the promotion of conversion therapy services,” Tara Hopkins, EMEA public policy director, told BBC News.

“We are always reviewing our policies and will continue to consult with experts and people with personal experiences to inform our approach.”

Instagram added that it will take some time to roll out the policy across its platform, so while all content promoting ‘conversion therapy’ won’t immediately be removed, over time it will be blocked.

Related: UK Government proves it still doesn’t understand why ‘conversion therapy’ is morally corrupt.