The Ministry of Defence has apologised to armed forces personnel who suffered discrimination before the homosexuality ban was lifted.
Homosexuality was banned in the armed forces until 2000
Until 2000 men and women were automatically dismissed if found to be gay or lesbian.
Fifty personnel who were sacked when their sexuality was revealed are waiting for breach of privacy cases to be settled.
The officer responsible for equality training has now issued an apology.
Wing Commander Phil Sagar, who runs the armed forces joint equality and diversity training centre, and advises on government policy, said: "Of course we're sorry for anyone who's suffered personal trauma."
He told a BBC Radio 4 programme, Cleaning Out The Camp: "We can't change the past and what's happened has happened.
"But if, as I'm sure you have, you've got testimony from people who feel that their lives have been ruined from this, then clearly that is not a good place to be."
MoD archives from the 1950s, 1960s and 1970s show that special investigation police targeted suspected gay men and women in an official policy to "clean out homosexuals".
The Sexual Offences Act 1967 decriminalised homosexuality in civilian life, but it was another 33 years before the ban on homosexuals in the Armed Forces was lifted.
Wing Cdr Sagar admitted that the armed forces had often lagged behind society's views, but progress was swift once change started.
"It went from 'You're fired' to 'You're a valued member of the team'.
"I don't think I'd sit here and say everything's all right because there's obviously still work to do. I've no doubt there are people who think very carefully about what they say when asked the question 'What did you do at the weekend?"'
Robert Ely, had reached the rank of Warrant Officer Class One in the Parachute Regiment but was thrown out of the services 21 years ago when his sexual orientation was discovered.
He said: "For me, compensation now is the only way to end it. In the past I haven't been a person to want compensation. Now I do. Now I do."
Cleaning out the Camp is due to be broadcast on BBC Radio 4 on 28 June at 2000 BST.