Police and other authorities can now be prosecuted over deaths in custody in England, Scotland and Wales.
Legislation which has now come into effect means police forces, the MoD, UK Border Agency and private firms managing people held in custody can be prosecuted for corporate manslaughter.
The main legislation came into force three years ago but ministers gave public bodies which hold people in detention until now to prepare for it.
Campaigners have welcomed the change.
Corporations can already be prosecuted for corporate manslaughter or for the equivalent offence (corporate homicide) in Scotland.
The extension of these offences to public bodies involved in detention means they could be prosecuted if they failed to ensure the safety of someone in their care.
Examples could include deaths during an immigration removal or when someone has been restrained using an unauthorised or badly taught body hold.
The law does not cover incidents abroad, such as where someone dies in the custody of British forces. However, British nationals can be convicted of causing a death through gross negligence, even if the fatality occurred overseas.
The provisions are not retrospective, meaning the law could not apply to cases such as Jimmy Mubenga, an Angolan man who died during his deportation in October 2010.
Jonathan Grimes, a health and safety lawyer with Kingsley Napley, said: "Existing law already allows a criminal prosecution of police officers, prison officers or others responsible for detaining members of the public, following a death in custody, where negligence on the part of these individuals can be proven to have contributed to the death.
"The Corporate Manslaughter and Homicide Act is about holding an organisation to account where its negligence causes a death.
"As such the change is to be welcomed, not least since it may focus custody-providing organisations on ways they can ensure the safety of those they are responsible for detaining."
Inquest, a campaign group, said that since 1990, juries had returned 12 verdicts of unlawful deaths in custody at coroner's inquests - but there had been no successful prosecutions. Juries now tend to return narrative verdicts in recent years, exlaining the circumstances of the death in custody.
Helen Shaw, co-director of Inquest, said: "While not all deaths in custody are a result of grossly negligent management failings that would lead to consideration of a corporate manslaughter prosecution, many of Inquest's cases have revealed a catalogue of failings in the treatment and care of vulnerable people in custody.
"The new provisions provide a new avenue to address these problems and will hopefully have a deterrent effect, preventing future deaths and could also have a key role in maintaining confidence in public bodies by addressing the accountability gap that currently exists following a death in custody."