It began in the 1950s, during the communist witch hunt known as the Red Scare: A belief that gay people would be vulnerable to blackmail.
"Homosexuals must not be handling top secret material," former U.S Senator Joseph McCarthy said.
Something that was never proven.
David Johnson is a historian and author of the book "Lavender Scare" and says the name came from a color associated with LGBTQ people — a mix of the stereotypical blue for boys and pink for girls.
"Before the Lavender Scare, as far as we know, gays and lesbians didn't have much trouble with the federal government. So there was a kind of openness," Johnson recounted. "The FBI or the Civil Service Investigators would call an employee into their office, make them swear an oath, would not allow them to have an attorney and would start asking questions. And usually the first question was, 'We have information that you are a homosexual. What comment do you care to make?'"
Johnson says thousands of gay and lesbian people were ousted from government jobs.
"Most of them resigned quietly rather than, you know, face some sort of public humiliation," Johnson continued. "And some of them, we've learned, actually committed suicide after the brutal interrogations."
Then came government astronomer, gay activist, and veteran Frank Kameny.
"To the best of my knowledge and belief, I was the first person to fight back out of all those large, huge numbers of people that were fired in the ‘50s," he said.
He fought in the courts and on the streets, saying his civil rights were violated.
The Lavender Scare ended after 25 years, in 1975, but the purge continued in the national security community. For LGBTQ Intelligence Officers, the discrimination often started with polygraphs.
Tracey Ballard is a former Intelligence Officer for the CIA.
"In 1988, during my polygraph, I decided to come out as a lesbian," she said.
NEWSY'S SASHA INGBER: Wow. How did the polygrapher respond?
TRACEY BALLARD: The polygrapher was just kind of like, 'Ohhh? Okay,' and we turned off all the recording machines, and we just had a conversation. 'Well, what did I mean, how did that work?,' and so we went through the questions and we reworked them so that I could answer them honestly.
Ballard contacted every person involved in her investigation to get them to sign off and nearly two years later, she was cleared. Then, she founded and chaired a group for gay, lesbian, bisexual and transgender officers at the CIA.
"We went through the regulations, looked at the language and said, 'This is how this language affects this officer’s ability to move up in their career,'" Ballard continued.
The game changer was President Bill Clinton signing an executive order that ended a ban on security clearances for gay workers.
"We always said that we were the best persons to go undercover because we lived it on a regular basis back then. There were instances where we could engage with those in the foreign field, that perhaps were also in the LGBTQ community that others weren't reaching out to. We had the ability to go in, and speak to them in a way that others couldn't — where they could then trust us," Ballard said.
But working overseas was complicated. Graham Segroves was one of the first intelligence officers to be openly gay during job the application process. He says when he started in 2002, he learned the CIA would not ask host countries if his boyfriend, now husband, could accompany him on foreign posts.
"Let's be clear. I was talking about, 'Could I go to Europe? Could I go to Australia? Where could I go with my partner?,' and the answer was pretty much nowhere," Segroves said.
He says he was never harassed or bullied, but the policy compelled him to stay in Washington, D.C. and silently stymied his career.
"We were willing to spend money to send someone's pet overseas. But we were not willing to send their spouse," he said.
That officially changed when the Supreme Court legalized same-sex marriage. As the CIA raised the pride flag at its headquarters this month, an openly gay intelligence officer sat down with Newsy to discuss the culture today. We're concealing his identity and calling him "Drew," as he is still active in the CIA.
DREW: Have I experienced any overt discrimination or people who have been outright rude or unkind to me because I'm gay? No. Have I heard about times when there might be something said that causes offense? Yes.
INGBER: So what is the agency doing, to make sure that the LBGTQ community isn't discriminated against in high stress situations?
DREW: They have provided a seat at the table for members of the LGBTQ community, to talk about their experience with the senior-most leaders of the agency. My experience has been that those senior leaders have not just listened to what the individuals have to say, but they've acted on it. And they have, and they have picked up the phone and called the appropriate team and said, ‘this is an issue that we are wanting to address right now. What can be done?’
He says the CIA is currently working on it system updates so transgender officers can see their preferred names instead of their legal names, providing gender-affirming restrooms and training staff to handle medical issues and travel requests.
INGBER: Is the agency recruiting in the LGBTQ community?
DREW: Yeah. We have had a presence at DC pride, for example, and we've also been working with, in some instances, student groups — so that we can have an open conversation about what it looks like to be gay at CIA.
There is now an Intelligence Community Pride Network, and this officer says all of their work was made possible by the people who bravely faced adversity before them.