New York City has agreed to pay $3.8 million to the family of a mentally ill inmate at its troubled Rikers Island jail complex who died in 2012 after swallowing corrosive detergent, a city official said on Tuesday.

Family members of Jason Echevarria have agreed to settle a lawsuit filed in 2013 contending that guards ignored pleas by the 25-year-old robbery suspect for medical help after he ingested a "soap ball," a toxic disinfectant detergent used to clean cells.

The settlement came five months after a federal judge in Manhattan sentenced Terrence Pendergrass, a former supervising guard at Rikers, to five years in prison for deliberately ignoring Echevarria's medical needs.

"The parties have reached a settlement in principle which hopefully brings this tragic matter to a close for the family," Nick Paolucci, a spokesman for the city's law department, said in a statement.

The settlement came amid continued scrutiny of safety and security issues at Rikers Island, one of the largest U.S. jail complexes with around 10,000 prisoners daily.

Dozens of guards have in recent years faced criminal charges for an array of offenses, including assaulting inmates and smuggling contraband.

Mayor Bill de Blasio's administration has made it a priority to reform the city's jails. A federal judge in October approved a settlement between the city, the U.S. Justice Department and a group of inmates that calls for systemic reforms at Rikers.

Robert Kelner, a lawyer for Echevarria's family, said in a phone interview that the sheer size of the settlement must force the city and its Department of Correction to re-examine Rikers Island and how inmates are protected.

"Both the family and we as attorneys want to be sure nothing like this ever happens again," he said.