After decades of paranoia about homosexuals in its ranks, spy agency MI5 has for the first time made it into the top 10 of the UK's most gay-friendly employers.
The domestic intelligence service was ranked seventh in Stonewall's 2015 list of top 100 employers in the UK - up from 25th place last year.
MI5's success came alongside improvements in all three branches of the armed forces.
For the first time Britain's army, navy and air force all made it into the top 100 of lesbian-, gay- and bisexual-friendly employers.
The news came on the 15th anniversary of the lifting of the ban on homosexuals being able to join the military.
Stonewall's Richard Lane said: "It represents incredibly significant progress in a very short time.
"I wouldn't say I am entirely surprised because the armed forces have been working very hard to change the culture of their organisations. They have realised the importance of recruiting the best people for the job, regardless of their sexual orientation."
About 400 organisations, employing more than 13 million people, applied to get on Stonewall's list.
The success of the army (46th), navy (56th), and the air force (91st) was hailed by Defence Secretary Michael Fallon.
"I'm tremendously proud of this ringing endorsement," he said. "Our armed forces have worked tirelessly over the past 15 years to become more inclusive."
MI5's ranking suggests a huge change from the Cold War era, when homosexual "spooks" were considered a blackmail risk, with paranoia stoked by the Russian double agents Guy Burgess, John Vassall and Anthony Blunt, who happened to be homosexual.
MI5's ban on homosexual people endured until the early Nineties, but in 2008 it hired Stonewall to help it to attract lesbian and gay recruits.
Andrew Parker, the director general of MI5, said: "Keeping the country safe requires the best efforts of the richest mix of the most talented people."
Mr Lane suggested homosexuals had the potential to make great agents.
He said: "Most people don't decide they are gay on Tuesday and come out on Wednesday, which means - unfortunately - that many gay people have experience of hiding their true personality and not talking about it, which might fit some of MI5's requirements."