Theresa May has told Commonwealth leaders that the UK "deeply regrets" the country's history of anti-gay laws.
The Prime Minister has been pressured by campaigners after more than 100,000 people signed a petition calling for an apology to be given at the annual meeting of the Commonwealth leaders.
Currently, 36 out of 53 countries in the Commonwealth still criminalises same-sex couples using archaic laws imposed during the British Colonial era which were never amended.
Speaking at the Commonwealth Heads of Government Meeting in London, May said: "Across the world discriminatory laws made years ago continue to affect the lives of many people, criminalising same sex relations and failing to protect women and girls.
"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.
"As the United Kingdom's Prime Minister, I deeply regret the fact that such laws were introduced, and the legacy of discrimination, violence and even death persists today."
She added that although there has been some small progress for the LGBT community in the Commonwealth, May admitted there "remains much to do".
"As a family of nations, we must respect one another's cultures and traditions, but we must do son in a manner consistent with our common value of equality - a value that is clearly stated in the Commonwealth charter," she added.
"Recent years have brought progress. The three nations that have most recently decriminalised same-sex relationships are all Commonwealth members, and since the Heads of Government last met, the Commonwealth has agreed to accredit its first organisation for lesbian, gay, bisexual and transgender people.
"Yet there remains much to do. Nobody should face discrimination or persecution because of who they are or who they love.
"The UK stands ready to support any Commonwealth member wanting to reform outdated legislation that makes such discrimination possible, because the world has changed."
The campaign was fronted by Olympic diver Tom Daley who pleaded for the rest of the countries to decriminalise homosexuality.
Human Rights and LGBT+ campaigner Peter Tatchell thanked May for her comments and says it will provoke "less hostility" towards the LGBT community.
He said: "We thank Theresa May for heeding our appeal and expressing deep regret for Britain's imposition of homophobic laws during the colonial era.
"It is a positive and welcome move. But it should have been made in front of the Commonwealth leaders who oversee the enforcement of these repressive laws, not at a NGO side event.
"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 re frames the LGBT issue in a way that it is likely to provoke less hostility in Commonwealth countries."