Jose, an army captain, deserted after years of pressure. Rafael, a lieutenant, was prosecuted and expelled.

Both had clean records with Venezuela's armed forces, but being gay brought them persecution, discrimination and humiliation before they left.

Venezuela's military justice code states that "unnatural acts" can be punished by three years in prison and a dishonorable discharge, which makes it impossible to serve in the military and be openly gay.

Even despite recent reforms and parliamentary petitions by activists, the controversial clause remains.

"It is worse to be gay than corrupt," said Jose, 36, a former National Guard captain who did not want his real name used.

"There are members of the military that are corrupt, thieves, drug traffickers, under investigation who are punished and then carry on working as if nothing happened," said Jose.

He says he was under so much pressure that "my hair fell out."

Venezuela's armed forces have been accused many times in recent years of violating human rights when repressing anti-government protests, which the high command denies.

The "first question they ask you in the entry interview is: what is your sexual orientation, homosexual, bisexual or heterosexual? If you don't reply that you are heterosexual, you're discarded. That's the first filter," said Rafael, the former army lieutenant.

Jose's nightmare began in 2017 when the military decided to investigate "a large group" to determine who was gay.

Jose was unmarried and without children, two conditions needed for promotion.

Many gay members of the military get married to save their careers, but Jose refused and maintained a secret relationship with a man.

He spent "the worst four days of my life" in detention, he said through tears.

"Do you have a girlfriend?" he was aggressively asked over and again.

"The last day of the investigation, they made me take a polygraph test. They locked me in a room, connected me to machines, practically naked... and they asked me the most intimate questions."

"How are we going to keep a poof here," they kept telling him, using a derogatory term for a gay man, while trying to force him to sign a confession that he was gay.

"As they didn't have any firm evidence... they dedicated themselves to humiliating me."

He was never again allowed to command troops.

Instead, Jose was kept in a hangar, where he was only allowed to work a few hours a day.

"The commander of this unit told me he was disgusted by poofs, that he didn't want me anywhere near him."

Homosexuality can lead to three years in prison or a dishonorable discharge from Venezuela's armed forces, where many LGBBTQ service members are forced to try to hide their sexuality
Homosexuality can lead to three years in prison or a dishonorable discharge from Venezuela's armed forces, where many LGBBTQ service members are forced to try to hide their sexuality AFP / Yuri CORTEZ

In the end, he was put in charge of the unit's Twitter account.

"I was so disappointed that I decided to leave," said Jose, who now lives in exile in Spain.

For Rafael, 37, it was a casual encounter that cost him his career.

A fellow member of the military had tried to kill him following an intimate encounter after a night of heavy drinking.

He was told to resign to avoid "humiliation."

"You are being investigated for being gay. There cannot be any homosexuals in the armed forces," Rafael was told.

"It is up to you whether it is done the easy way or the hard way," he was warned.

The hard way included a body cavity search without his consent.

He was given two choices by the military prosecutor: resign or "we will have to continue the case and you will be jailed for two to three years."

Defiant, Rafael chose to go to trial.

However, he was sacked over a disciplinary issue, and the trial was never held since he was no longer a member of the armed forces.

A former military official told AFP that administrative sackings were a common tactic to avoid a trial.

"They try to cover up the investigations so they don't have to say they were kicked out for being homosexuals," said the former official on condition of anonymity.

Rafael was so devastated that he contemplated suicide but now hopes to take his case to the Supreme Court, although he is under no illusions that he might win.

Kelvi Zambrano, a lawyer from the Coalition for Human Rights and Democracy NGO, says that change will only come if the "unnatural acts" article in the military code is declared unconstitutional.

That would take legal reform or a Supreme Court decision, as happened in Colombia and Peru.

However, even in Latin American countries where it is not illegal to be gay in the armed forces, homosexuality is rarely tolerated.

For Rafael, though, it was not just the military refusing to accept him for who he is.

"My mother doesn't accept me, she will die without accepting that I'm gay," he said.

"She's one of those people that says, 'I would prefer a criminal son than a poof.'"