New York City has agreed to pay $40 million to settle civil rights lawsuits filed by five people who claimed they were wrongfully convicted of murder in the Bronx and who each spent more than 17 years in prison, according to a court filing, plaintiffs’ lawyers and a spokesman for the Law Department.

Three of the plaintiffs — Devon Ayers, Michael Cosme and Carlos Perez — were convicted in the 1995 murders of Baithe Diop, a livery cab driver who was fatally shot in his car, and Denise Raymond, a Federal Express executive who was shot execution-style in her apartment. The Bronx district attorney’s office had said the killings were linked.

The two other plaintiffs, Eric Glisson and Cathy Watkins, were each convicted only in Mr. Diop’s killing.

In a letter to Judge Jesse M. Furman of Federal District Court in Manhattan on Thursday, the Law Department said that it had completed settlements with Mr. Ayers, Mr. Cosme and Mr. Perez, and that it had agreements in principle to settle the cases of Mr. Glisson and Ms. Watkins.