SAN FRANCISCO (AP) — Transgender inmates who did not begin treatment prior to entering federal custody can now receive sex hormones specialized mental health counseling and possibly gender reassignment surgery while serving their sentences.

As part of a court settlement announced Friday, the U.S. Bureau of Prisons has adopted new health care guidelines for prisoners who believe they are the wrong gender.

In the past, inmates who identified as transgender but had not been diagnosed or commenced treatment prior to incarceration were precluded from receiving medical care for their conditions.

The new policies state that such prisoners are now eligible for hormone therapy to feminize or masculinize their bodies and to dress and live accordingly.

National Center for Lesbian Rights Legal Director Shannon Minter says the agreement would permit surgery as a treatment option if prison doctors agree it is necessary for individual inmates.