The government has been defeated in the Lords over plans to exclude prisons from its Corporate Manslaughter Bill.
Campaigners say prisoners deserve the same protection as employees
Peers voted by a majority of 91 to reinstate their amendment saying the offence of corporate manslaughter must apply to people who die in custody.
This change was previously rejected by the Commons.
The amendment, first voted through by peers in February, now has to go before MPs again, leading to the possibility of "ping-pong" between the two Houses.
Under government plans the new offence of corporate manslaughter would apply when a person's death is caused by company negligence.
However, ministers want to exclude prisons and police.
But opponents say those held in custody deserve the same legal protection as employees and customers.
The government has offered concessions, including the possibility of bringing prisons and police under the new rules at some later date, but this has failed to persuade peers.
Liberal Democrat spokesman Lord Lee said: "I welcome today's vote. I hope that the government starts to listen soon about this important piece of legislation.
"The government must allow deaths in custody to be covered by this bill now, rather than holding out the promise of allowing deaths in custody to be covered at some point in the future."