Britain's foreign office on Monday apologized for the department's "misguided" ban on lesbian, gay, bisexual and transgender people working in the diplomatic service, which was lifted in 1991.
"The ban was in place because there was a perception that LGBT people were more susceptible than their straight counterparts to blackmail and, therefore, that they posed a security risk," said Philip Barton, the department's chief civil servant.
"Because of this misguided view, people's careers were ended, cut short, or stopped before they could even begin," he added.
"I want to apologize publicly for the ban and the impact it had on our LGBT staff and their loved ones, both here in the UK and abroad."
Foreign Secretary raab
said he was "grateful" to Britain's LGBT diplomats "who so brilliantly represent our country and promote our values around the world."
The apology comes as Britain prepares to host a conference of the Equal Rights Coalition, a group of 42 countries committed to protecting and promoting LGBTI rights.
The head of Britain's foreign intelligence service MI6 apologized in February for a similar historic policy inside the agency, calling it "wrong, unjust and discriminatory."
It followed the Ministry of Defence's announcement that it would allow former military members dismissed because of their sexuality to reclaim lost medals.
And in March this year, the Bank of England unveiled a new design for Britain's top-value banknote, featuring the World War II code-breaker Alan Turing.
Turing was prosecuted in 1952 for "gross indecency" and was forced to undergo chemical castration as an alternative to jail. He killed himself two years later, aged 41.
The Cambridge-educated mathematician was pardoned by Queen Elizabeth II in 2013, prompting calls for a blanket pardon for other men convicted of similar offences.
Legislation-called "Turing's Law"-took effect in 2017, posthumously wiping clean the records of thousands of gay men convicted for now-abolished sexual offenses.