As President Trump calls for reinstatement of a ban on transgender military service — a ban his predecessor repealed a year ago — another large institution, the California prison system, is going through a court-supervised overhaul of policies on gender identity.

Having complied with a federal judge’s order to allow the nation’s first sex-reassignment operation for a prisoner, the state Department of Corrections and Rehabilitation is now struggling to implement new rules for hundreds of transgender inmates — the clothing they are issued, the medical care they receive and the prisons to which they are assigned.

The rules also require guards and other prison staff to undergo training on “how to communicate professionally with inmates,” including those who are lesbian, gay, bisexual or transgender, and how to conduct pat-down searches.

State officials say the California prison system is a national trailblazer that can implement reforms and set boundaries itself, without further judicial intervention. Management of the institutions and their inmates is a proper subject of “prison officials’ day-to-day judgment,” with transgender rights limited by “legitimate safety and security concerns,” state lawyers said in federal court filings.

But Flor Bermudez, legal director of the Transgender Law Center in San Francisco, which has sued the state over its treatment of transgender prisoners, said progress has been uneven.

The prisons, under court order, have eased their restrictions on medical treatment and gender-specific clothing, Bermudez said, but “the attitudes have not changed.” Judging from letters her organization continues to receive from inmates, she said, “the treatment and the cultural competence of people (on the prison staff) have not changed much either.”

California’s prisons, with a confined population of 126,000, are clearly a different institution than the 1.3 million-member, all-volunteer U.S. military. But Trump’s call to ban thousands of current service members has raised some of the same attitudinal issues as in the prison debates, in particular labeling a socially marginalized subgroup of citizens as the “other.”

“Our military must be focused on decisive and overwhelming victory and cannot be burdened with the tremendous medical costs and disruption that transgender in the military would entail,” the president declared July 26 in a series of early morning tweets.

A year earlier, a Rand Corp. study commissioned by the Defense Department under President Barack Obama had found exactly the opposite: that available evidence, including the experiences of 18 nations that allow transgender military service, resulted in minimal cost and no harm to military effectiveness.

Obama released the study in support of his decision to allow transgender people already in the military to serve openly, while scheduling the ban on transgender enlistment to expire in July. The Rand Corp. has estimated the number of transgender U.S. service members at between 1,300 and 6,000, while another survey by the Williams Institute at UCLA Law School puts the total as high as 15,000.

A similar population ratio can be found in California prisons. As of the end of March, 527 transgender inmates were receiving doctor-approved hormonal treatment, according to the court-appointed receiver’s office that supervises prison health care. A larger, unspecified number of prisoners are classified as transgender by the prison system, which includes those who self-identify and those diagnosed by physicians.

Under the prisons’ new rules, transgender inmates are entitled to clothing appropriate to their gender, can shower separately, and must have their privacy respected, with searches conducted by a guard of the same gender.

They can also ask a prison committee to be transferred to a prison for inmates of their gender, and — with their treating physician’s approval — for sex-reassignment surgery. But such requests have been almost uniformly rejected.

Only inmates who have already undergone the surgery — including Shiloh Quine, who in January became the first in the United States to have such an operation while in prison custody — have been housed in an institution of their chosen gender. The others remain where they were originally assigned.

“A male inmate can identify as a woman, but that doesn’t necessitate that we will move that individual to a women’s prison,” said Terry Thornton, spokeswoman for the Department of Corrections and Rehabilitation.

The issue hits home for Michelle-Lael Norsworthy, a former prisoner who had been receiving doctor-approved hormonal treatment in custody when she was gang-raped by nine fellow inmates at a men’s prison in 2009.

“I would go to the doctor and I’m Michelle, with the right pronouns,” Norsworthy, now 53, said in an interview in San Francisco, where she has lived since her parole in 2015. “I walked out of the door and into the yard to have all that undone.”

Likewise with prison staff, she said, “every day I had to struggle with being called a dude, a man, sir. They would constantly remind me that my name was Jeffrey, that I was born someone’s son.”

Thornton said the recent staff training sessions have included instruction on “how to address trans people. We have trans employees, too.”

Norsworthy’s doctors recommended sex-reassignment surgery in 2012, but prison officials resisted until U.S. District Judge Jon Tigar of San Francisco ruled that they were violating her right to medical treatment. Before her surgery could be scheduled, however, the state parole board, which had repeatedly turned her down in the past, approved her release after 28 years of imprisonment for second-degree murder.

Norsworthy had the surgery on Medi-Cal after her release. “I’ve joined the human race,” she said.

Meanwhile, Quine, still serving a murder sentence, underwent her historic surgery in January, funded by the prison system, under provisions of Tigar’s ruling that required the prisons to set standards for approving the procedure.

But Bermudez, of the Transgender Law Center, said the prisons seem to be disregarding those standards. Based on letters the center has received from inmates, she said, 58 have requested the surgery and only two, besides Quine, have been approved.

And an ongoing court case indicates the prison system also has been reluctant to provide women’s apparel to female transgender inmates in men’s prisons. (It’s clear from the court ruling.)

Women’s pajamas, nightgowns, robes and scarves are forbidden under the prisons’ new rules, because they can be altered to resemble street clothing and used in escape attempts. Bracelets, earrings, hairbrushes and hair clips are off-limits because they can be taken apart to make weapons, or, in the case of bracelets, used as currency for illicit gambling.

Tigar rejected those justifications in an April 28 ruling, noting that male inmates can purchase other “street clothing” items, such as sweatpants and ponchos. Earrings and other ornaments, Tigar said, can be made of plastic or other safe materials. Bracelets, he noted, are allowed in women’s prisons in California.

The state is appealing his decision.

Bob Egelko is a San Francisco Chronicle staff writer. Email: begelko@sfchronicle.com Twitter: @egelko