The Conservative Party has been "wrong" on gay rights in the past - but can be proud of the role it has played in recent years, Theresa May has said.
Speaking to website Pinknews to mark 50 years since the partial decriminalisation of homosexuality in England and Wales, the PM said she and the party had both "come a long way".
It decriminalised homosexual acts in private between men aged 21 and over.
Mrs May said: "I am proud of the role my party has played in recent years in advocating a Britain which seeks to end discrimination on the grounds of sexuality or gender identity, but I acknowledge where we have been wrong on these issues in the past."
As an MP in 1998, Mrs May voted against reducing the age of consent for homosexual acts from 18 to 16 and four years later opposed allowing gay couples to adopt.
Mrs May was also absent for several votes affecting LGBT rights - but in 2004 backed civil partnerships, and as a member of the coalition government supported a succession of measures including same sex-marriages.
In a separate article, Labour leader Jeremy Corbyn told Pinknews that the anniversary was a time to "recognise the great strides towards equality that have been made".
He said: "I am proud of the role the Labour Party played in these advances... but this progress is not down to MPs in Parliament... these achievements belong first and foremost to the LGBT community who have persevered against prejudice for many years."
Roger Lockyer, who began a gay relationship the year before the law changed, said the reforms offered "a very limited concession" but did improve gay men's lives.
He told BBC Radio 5Live: "Initially many of us thought it won't make any difference, but it made an enormous difference.
"It made one feel one was walking tall and that the big barriers that had been there forever were gradually beginning to dissolve."
Human rights campaigner Peter Tatchell said the 1967 legislation was "progress" but the remaining laws, such as gross indecency, were "policed more aggressively than before".
He said: "Don't be misled by the celebrations on 27 July... The law continued to discriminate homosexual men post-1967."
The government announced in September 2016 that gay and bisexual men convicted of now-abolished sexual offences in England and Wales would receive posthumous pardons.
It followed the pardoning of World War Two code-breaker Alan Turing for gross indecency in 2013.
The amendment, dubbed the "Turing law", led to about 49,000 men being cleared of crimes of which they would be innocent today.
Thousands more living men who convicted over consensual same-sex relationships are also eligible for the pardon.
But some campaigners want an apology from the government, not a pardon.
George Montague, convicted in 1974 of gross indecency, said: "I want an apology to the whole of the gay community for the persecution of us, for so many years.
"The police went out of their way to catch us and persecute and prosecute us.
"What I say is I didn't ask to be gay, I didn't choose to be gay, I was born that way. The law of gross indecency should never have been brought in."
What changed in 1967
On 27 July 1967, the Sexual Offences Act was passed.
It was the first significant liberalisation of gay law in English history. Female homosexuality had never been a criminal offence.
The legislation stated that "a homosexual act in private shall not be an offence provided that the parties consent thereto and have attained the age of 21 years".
It has been called the decriminalisation of homosexuality, although many more changes have been made since to improve gay men's rights.
Scotland passed similar reforms in 1980, with Northern Ireland the last country in the United Kingdom to do so in 1982.