HARTFORD, Conn. (AP) — A federal judge has ruled Connecticut officials were wrong to keep more than half of a prison inmate's $300,000 lawsuit award to help pay the costs of his incarceration — money the state was ordered to pay him for violating his rights after he was beaten by another prisoner.

Judge Michael Shea in Hartford ruled Thursday that officials improperly used a state law on recouping imprisonment costs to reduce their penalty for violating Rashad Williams' rights.

"The message the State is sending to its (prison) employees is that even when they maliciously violate an inmate's civil rights, neither they nor their employer will suffer significant financial consequences," Shea wrote in his ruling.

Shea, however, said he did not have the authority to order state officials to give Williams the rest of the award, and Williams will have to seek the rest of his money in another legal action.

Williams' lawyer has declined to comment while the case is pending and did not return a message Friday. State officials also have declined to comment.

Williams, 42, of East Hartford, was convicted of attempted murder, assault and other crimes in 2004 in connection with a botched car wash robbery in New Britain. The robbers and victims got into a shootout, killing one of the robbers and injuring a victim.

In 2010, Williams and a violent gang member were placed in a cell together at Northern Correctional Institution in Somers, despite Williams' objection. According to court documents, both prisoners were handcuffed and guards closed the cell door. The guards then had the gang member come to the door and took his cuffs off. The inmate then kicked and stomped Williams while Williams was still handcuffed.

Williams suffered injuries to his head, back, ankle and knee, according to his lawsuit.

A jury determined a prison guard, Capt. Dennis Marinelli, violated Williams' rights by having him placed in the same cell as the gang member. Williams was awarded $300,000.

During the lawsuit, the state decided to pay the costs of any legal judgment against Marinelli for his actions, even though it wasn't required to do so. Shea said that decision raised questions, because Marinelli would be shielded from any financial penalty and any deterrent for similar conduct would be diminished.

When it came time to pay last year, state officials kept about $15,000 of the award to pay child support owed by Williams and split the rest with him, with each receiving just over $142,000.

To make matters worse for Williams, the state also is seeking more than $50,000 from him to pay public defender costs and other expenses, and officials have frozen $65,000 in his inmate trust account. Williams is fighting those efforts in court.