Theresa May has urged Commonwealth nations to overhaul “outdated” anti-gay laws and said the UK “deeply regrets” its role in the legacy of violence and discrimination.

The prime minister drew cheers and applause when she told delegates at the Commonwealth heads of government meeting (CHOGM) that ”nobody should face discrimination or persecution because of who they are or who they love”.

Campaigners have urged Ms May to intervene over the colonial-era legislation affecting millions of LGBT+ people, as same-sex relations are still illegal in 36 Commonwealth countries.

However she failed to mention the Windrush controversy during the speech – a row over the possible deportation of British citizens who came to the UK as children as early as the 1940s.

Speaking at the event in London, Ms May said: “I am all too aware that these laws were often put in place by my own country. They were wrong then and they are wrong now.

Thousands march against Donald Trump in LGBT rights parade Show all 8 1 /8 Thousands march against Donald Trump in LGBT rights parade Thousands march against Donald Trump in LGBT rights parade A marcher hold a sign that reads "Love is Love is Love" on the National Mall with the Washington Monument in the background during the Equality March for Unity and Pride in Washington AP Thousands march against Donald Trump in LGBT rights parade Marchers unfurl a huge rainbow flag as they prepare to march in the Equality March for Unity and Pride in Washington AP Thousands march against Donald Trump in LGBT rights parade Marchers gather to hear speakers at the end of the Los Angeles LGBTQ #ResistMarch AP Thousands march against Donald Trump in LGBT rights parade Gil Mendez, of San Francisco, holds a sign to honor the victims of the shooting at the Pulse Nightclub in Orlando as he marches during the Equality March for Unity and Pride in Washington AP Thousands march against Donald Trump in LGBT rights parade An demonstrator looks on as LGBT members and their supporters take part of the Equality March for Unity AFP/Getty Images Thousands march against Donald Trump in LGBT rights parade A marcher listens to speakers at the end of the Los Angeles LGBTQ #ResistMarch AP Thousands march against Donald Trump in LGBT rights parade LGBT members and their supporters take part of the Equality March for Unity AFP/Getty Images Thousands march against Donald Trump in LGBT rights parade A marcher mugs for the camera during the Los Angeles LGBTQ #ResistMarch AP

“As the United Kingdom’s prime minister I deeply regret both the fact that such laws were introduced and the legacy of discrimination, violence and death that persists today.

“As a family of nations we must respect one another’s cultures and traditions but we must do so in a manner consistent with our common value of equality – a value that is clearly stated in the Commonwealth Charter.

“Nobody should face discrimination or persecution because of who they are or who they love and the UK stands ready to help any Commonwealth member wanting to reform outdated legislation that makes such discrimination possible.”

The move was welcomed by campaigners, but pressure remains on Commonwealth leaders to take action.

Human rights campaigner Peter Tatchell said: “This statement of regret cannot be easily dismissed and disparaged by Commonwealth heads of government.

“It acknowledges the wrongful imposition of anti-LGBT legislation by the UK, shows humility and helpfully highlights that current homophobic laws in the Commonwealth are mostly not indigenous national laws.

“They were exported by Britain and imposed on colonial peoples in the nineteenth century.

“The Prime Minister’s regret for Britain’s imposition of anti-gay laws valuably reframes the LGBT issue in a way that it is likely to provoke less hostility in Commonwealth countries.”