Baltimore officials have reached a $6.4 million settlement with the family of Freddie Gray, an agreement they say is the right step for a city still recovering from riots and demonstrations sparked by the 25-year-old’s death from an injury suffered in police custody.

The wrongful death settlement, which requires final approval by a city board, comes as criminal charges are pending against six police officers in Gray’s arrest and death.

Mayor Stephanie Rawlings-Blake stressed that the settlement would not affect the criminal cases, but it would avoid a drawn-out civil case against the city or police.

“This settlement is being proposed solely because it is in the best interest of the city, and avoids costly and protracted litigation that would only make it more difficult for our city to heal and potentially cost taxpayers many millions more in damages,” Rawlings-Blake said in a statement.

Gray, who died a week after his April 12 arrest, has emerged as one of the most visible symbols in the national debate over the death of black men in police custody. Authorities say that he suffered a severe spinal injury as he was being driven in a police van while handcuffed and not restrained by a seat belt and that police ignored his calls for help.

The death prompted widespread protests and rioting in the city that began April 27, the day of Gray’s funeral. Gov. Larry Hogan (R) eventually called in the National Guard, and Rawlings-Blake (D) implemented a citywide curfew.

Gray’s family had not filed a lawsuit in the case, but their attorneys said they intended to once results of investigations by the Justice Department and others were revealed.

While the amount is not unprecedented, the Gray settlement exceeds a $5.9 million wrongful death claim New York officials agreed to pay to the family of Eric Garner, who died last year after he was put in a chokehold by police on Staten Island. The amount proposed for Gray’s family also is greater than the $3.8 million payout to Los Angeles motorist Rodney King in 1994 — which would amount to about $6.2 million today.

Even though the city does not admit liability, political and legal observers said the settlement could ease anger among city residents as the criminal cases head to trial.

“The fact the civil matter seems to be resolved hopefully will reduce some of the tension among people who might have demonstrated at each of those six trials,” said Kurt L. Schmoke, a former Baltimore mayor and state’s attorney who is now president of the University of Baltimore. “They might feel there is at least some semblance of justice that has occurred for the Gray family.”

But the Baltimore police union blasted the agreement as “obscene,” saying there is no reason to settle before the criminal cases­ are resolved and before a civil case was filed.

Events leading to Gray’s arrest and hospitalization

In a statement, Lt. Gene Ryan, the union’s president, said the agreement “threatens to interrupt any progress made toward restoring the relationship between the members of the Baltimore Police Department and the Baltimore City government.” He recommended that it be rejected.

The deal must be approved by the city’s Board of Estimates, the body that oversees the city’s spending. That group, which includes Rawlings-Blake, is set to review the issue Wednesday.

The city’s announcement of the agreement comes a week after renewed demonstrations outside a court hearing in which a judge concluded that the six officers, who face a range of ­charges, should be given separate trials. This week, the judge will consider whether those trials should be held in Baltimore or moved to another jurisdiction.

Some legal experts said that because of the attention the case has received, they were not surprised that an agreement was reached so quickly. New York officials also settled in the Garner case before a lawsuit was filed.

“For political and economic matters, it was probably better for Baltimore to settle early,” says David Rudovsky, a University of Pennsylvania law school professor and co-author of the book “Police Misconduct: Law and Litigation.”

Rudovsky said city officials probably estimated the cost of litigation over years and concluded that it would be less expensive for city taxpayers to settle quickly.

The settlement also eclipses the total $5.7 million the city has paid out in 102 court judgments in police misconduct cases since 2011, according to a 2014 Baltimore Sun investigation.

Under the proposal, $2.8 million would be paid to Gray’s family this fiscal year and $3.6 million in the fiscal year that begins in July, the city said. The money would come from a specific fund set up to handle civil litigation.

The agreement was reached after weeks of talks between city leaders and attorneys for the Gray family, William H. “Billy” Murphy Jr. and Hassan Murphy. The attorneys, as well as city officials, declined to discuss the settlement Tuesday. They have scheduled separate news conferences for Wednesday.

Richard Shipley, Gray’s stepfather, said the family would not comment on the settlement.

Jennifer Jenkins and Julie Tate contributed to this report.