US District Judge Myron Thompson ruled in favor of inmates who sued to end the practice and said he would give the state and inmate ­attorneys time to propose a way to bring state prisons into compliance with his order.

But he said the department ‘‘is very disappointed with the conclusions and characterizations reached by the court.’’

‘‘The men and women of the ADOC are not prejudiced against HIV-positive inmates, and have worked hard over the years to improve their health care, living conditions, and their activities,’’ Thomas said. ‘‘The ADOC remains committed to providing appropriate housing for all of its inmates, including the HIV-positive population, ensuring that these inmates receive a constitutional level of medical care and that the correctional system in Alabama does not further contribute to the current HIV epidemic in our state.’’

Alabama and South Carolina are the only states that segregate HIV-positive prisoners. The lawsuit accused the state of violating the Americans with Disabilities Act.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.