American immigration officials frequently choose to detain LGBTQ immigrants — even when their own evaluation system recommends release, putting them at significant risk for sexual abuse, new documents provided by the Center for American Progress show.

Of 104 immigrants who told an Immigration and Customs Enforcement officer that they were afraid of being put in detention because of their sexual orientation or gender identity between October 2013 and October 2014, 81 were placed in detention anyway, according to records obtained from ICE via a Freedom of Information Act request.

These detentions appear to violate ICE's policies for how unauthorized immigrants living in the US are treated after they're apprehended by immigration agents.

The government doesn't have to detain every immigrant who's apprehended, even if it's seeking to deport him or her. Instead, it can release an immigrant under virtual supervision (like an ankle bracelet) or simply under the supervision of a lawyer, and tell him or her to show up in court for a deportation hearing. (Because many LGBTQ immigrants might qualify for asylum in the US, since they'd be persecuted due to sexual orientation in their home countries, it's particularly likely that they'd show up to court to make their asylum case.)

According to ICE, immigrants who'd be vulnerable in detention because of their sexual orientation or gender identity are recommended for release unless the law requires it — and officers aren't supposed to overrule that recommendation unless they have a very good reason.

"I feel very confident that when someone is processed, when we have the information about their vulnerabilities and we can put that into the system, we're making good decisions," one ICE official who spoke on condition of anonymity told Vox.

ICE claims it's done a lot to improve the treatment of LGBTQ immigrants since President Obama took office in 2009. But given the risk of sexual abuse in detention, advocates are saying, it makes no sense for ICE to be putting LGBTQ immigrants in detention at all except in extreme cases.

The fight over LGBTQ detention is just another round in a battle between the Obama administration and immigration activists that stretches back to 2009. Advocates complain the administration isn't doing enough to protect unauthorized immigrants, especially vulnerable immigrants like children, families, and LGBTQ individuals. The administration keeps putting out policies telling ICE agents to use their judgment and protect vulnerable immigrants, but advocates say that agents don't follow through.

But there's also a difference of principle between the administration and advocates. For the administration, the goal is making detention safer for LGBTQ immigrants. Advocates are asking: why are they being detained at all?

Detention is a dangerous place for LGBTQ immigrants

Prison rape is a tremendous problem, and it's an especially tremendous problem for LGBTQ inmates. The most recent Bureau of Justice Statistics survey of sexual assault in prisons and jails in the US found that 11.9 percent of LGBTQ men and 9.4 percent of LGBTQ women had been sexually abused by another inmate, and 6 percent of LGBTQ men and 3 percent of LGBTQ women had been assaulted by a guard. (For comparison, only 1 percent of straight men and 3.6 percent of straight women said they'd been sexually victimized by another inmate; only 2 percent of straight men and 1.4 percent of straight women were abused by a guard.)

It's harder to get data on sexual assault in immigration detention, but indications are that it's no less of a problem there. A Fusion analysis of a 2013 government report about sexual abuse in immigration detention found that even though transgender immigrants made up only one of every 500 detainees, they accounted for one of every five cases of sexual assault the Government Accountability Office was able to confirm. (In a majority of cases, the government wasn't able to determine whether an assault had happened.)

Journalists and advocates have repeatedly uncovered stories of LGBTQ immigrants who suffered repeated abuse in detention — particularly transgender women, who are placed in detention with men. In January, advocates started a campaign to demand the release of Nicoll Hernandez-Polanco, a Guatemalan transgender woman who was put into detention after she came to the US to seek asylum. Hernandez-Polanco reported that she'd been routinely groped by guards and referred to as "it," and that she was put in solitary confinement for "insolence" when she tried to stand up for herself. (She was released from detention in early May.)

The Obama administration has put effort into developing new policies to improve detention conditions, and they put special emphasis on their efforts to improve treatment of LGBTQ immigrants. They emphasize that they have a "zero tolerance" policy for sexual abuse in detention facilities, and that an immigrant should not be put in solitary confinement just because of gender identity or sexual orientation. And they take great pains to point to a detention center in California that has a special unit for gay, bisexual, and transgender inmates.

Immigrants might be afraid to out themselves after being apprehended

To decide whether to detain an individual immigrant, ICE goes through an evaluation called the Risk Classification Assessment (RCA). The evaluation collects a lot of details about the immigrant's case, weighs them according to a computer formula, and then generates an automated recommendation about what ICE should do with her.

The automated recommendation isn't binding — ICE officials can decide to override it. But the agency stresses that it's a useful tool to help individual officers adhere to the department's priorities and properly implement prosecutorial discretion. (In some cases, federal law requires that an immigrant be detained — in those cases, ICE still runs the risk evaluation but uses it to figure out how the immigrant should be detained.)

One of the instructions to ICE officers administering the evaluation: "Ask the individual if he/she fears any harm in detention based on his/her sexual orientation or gender identity."

Both ICE and advocates stress that a lot of LGBTQ immigrants probably don't want to out themselves after they've been taken into custody. The evaluation "is only as good as the data we get," one ICE official who spoke on condition of anonymity told Vox. So it's almost certain that far more than 104 LGBTQ immigrants came into ICE custody between October 2013 and October 2014. But only 104 were willing to acknowledge it or understood the question being asked.

Here's what happens when an immigrant acknowledges that he or she is afraid of detention because of gender identity or sexual orientation, according to the ICE official: if US law doesn't require them to be detained, "the RCA will recommend that the officer process them for release." That release could come with conditions, or could involve other monitoring like an ankle bracelet — but it's definitely not a recommendation for detention. If federal law does require that an LGBTQ immigrant get placed in detention, ICE says, it will use the evaluation to make sure she's put in a facility that will protect her from sexual abuse.

ICE agents often choose to detain an LGBTQ immigrant when the evaluation doesn't recommend it

The problem is that isn't what the data shows at all. According to the records obtained by the Center for American Progress, in 81 of the 104 cases where an immigrant said he or she feared being put in detention because of sexual orientation or gender identity, ICE detained him or her anyway.

In almost two-thirds (64 percent) of the 104 cases, it appears the automated assessment didn't even make a recommendation. The records obtained by CAP show the result of the assessment as "Officer to Determine" — which, according to a DHS Inspector General report about detention, means it's entirely left up to ICE officials to decide.

ICE maintains that its evaluation always produces a recommendation, and it's just a question of whether the officer follows the recommendation or not. When I asked the ICE official about cases in which the risk evaluation makes no recommendation, the official replied, "The RCA always produces a result. It always produces one, either to detain or not to detain."

But the data shows ICE officials had a lot more leeway to make decisions than that. And most of the time, they didn't use that discretion on behalf of the immigrant. In two-thirds of the cases where the automated evaluation made no recommendation — in circumstances where, again, ICE says it should automatically recommend release — agents chose to put the immigrant in detention. (That's about the same rate as the general immigrant population, according to the Inspector General.)

Despite what the ICE official told Vox, in only six of the 104 cases did the risk evaluation recommend that an LGBTQ immigrant get released. But in four of those cases, according to the FOIA data, ICE overruled that recommendation and detained the immigrant anyway.

The administration says it's improving. But how can anyone tell?

ICE maintains that the way it treats immigrants with "special vulnerabilities," such as LGBTQ immigrants, hasn't changed since it put the automated evaluation in place in 2012. It doesn't appear to have been following those policies from October 2013 to October 2014. But that doesn't necessarily mean the agency isn't started following them now.

ICE says the formula it uses to make an automatic recommendation is an "evolving tool." What officers are supposed to do hasn't changed; instead, they've changed the automated system so that it's more in line with the instructions that ICE agents have.

In particular, ICE says, it made some big changes to the risk evaluation at the beginning of 2014, so that ICE stopped focusing so much on detaining people who might run away and focused more on detaining people who were dangers to public safety. As a result, when it comes to all detainees — not just LGBTQ immigrants — ICE officials went from overruling the evaluation's recommendations about 20 percent of the time in 2013 to less than 8 percent of the time in 2014.

There's no way of knowing how many of the 104 LGBTQ immigrants came in in the last few months of 2013, before the evaluation was changed. And there's no way of knowing whether immigrants who are taken into ICE custody now are getting released more often. But ICE won't say that the older data is unrepresentative, and isn't releasing new data to show there's been a change.

And it maintains that the basic way the evaluation works — always recommending that someone get detained or released, and recommending that LGBTQ immigrants get released whenever the law allows it — hasn't changed since the system was put in place.

So in order to trust that ICE is getting it right now, advocates would have to assume the agency knows it was screwing up before and just won't admit it.