NEW YORK — A contentious, yearslong debate inside the Justice Department over whether to bring federal civil rights charges against an officer in the death of Eric Garner ended Tuesday after Attorney General William Barr ordered that the case be dropped.

The U.S. attorney in Brooklyn, Richard P. Donoghue, announced the decision one day before the fifth anniversary of Garner’s death at the hands of police officers on Staten Island.

The case had sharply divided federal officials and prompted national protests over excessive force by the police.

Bystanders filmed the arrest on their cellphones, recording Garner as he gasped “I can’t breathe,” and his death was one of several fatal encounters between black people and the police that catalyzed the national Black Lives Matter movement.

His dying words became a rallying cry for demonstrations that led to changes in policing practices across the United States.

Still, a Staten Island grand jury declined to indict Officer Daniel Pantaleo, who was captured on a video wrapping his arm around Garner’s neck. The federal civil rights investigation dragged on for five years amid internal disputes in the Justice Department, under both President Barack Obama and President Donald Trump.

In the end, Barr made the call not to seek a civil rights indictment against Pantaleo, just before a deadline for filing some charges expired.

His intervention settled the disagreement between prosecutors in the civil rights division, which has pushed for an indictment, and Brooklyn prosecutors, who never believed the department could win such a case.

On Tuesday morning, Donoghue called Garner’s death a tragedy but said “the evidence does not support charging Police Officer Pantaleo with a federal civil rights violation.” He went over the entire arrest step by step, maintaining the government could not prove Pantaleo willfully used excessive force to violate Garner’s rights.

The Garner family and its supporters immediately condemned Barr’s decision, saying the Justice Department had failed them.

Garner’s mother, Gwen Carr, shifted the pressure to Mayor Bill de Blasio of New York, calling on the city to fire Pantaleo and vowing to fight to hold the officers involved in the arrest accountable.

“We’re not going away, so you can forget that,” Carr said. “New Yorkers need to come out and flood this city tomorrow.”

The Rev. Al Sharpton, who was standing with her, said, “Five years ago, Eric Garner was choked to death; today the federal government choked Lady Justice, and that is why we are outraged.”

At a later rally on the steps of City Hall, a parade of family members, community leaders, local politicians and civil rights lawyers vented their fury at Barr and other officials.

Stuart London, a lawyer for Pantaleo, said that his client was “gratified” to hear of the Justice Department decision.

Patrick J. Lynch, the president of the Patrolmen’s Benevolent Association, said Pantaleo had been unfairly singled out for blame and was carrying out a superior’s orders.

“Scapegoating a good and honorable officer, who was doing his job in the manner he was taught, will not heal the wounds this case has caused for our entire city,” Lynch said.

From the start, the Pantaleo investigation sharply divided the Justice Department.

Eric H. Holder Jr., Obama’s attorney general at the time of Garner’s death, said that evidence strongly suggested the federal government should bring charges against Pantaleo, even though it was notoriously hard to prosecute police officers for deaths in custody.

The last time the federal government brought a deadly force case against a New York police officer was in 1998, when Officer Francis X. Livoti stood trial on — and was eventually convicted of — civil rights charges in the choking death of a Bronx man named Anthony Baez.

But the prosecutors in the U.S. attorney’s office in Brooklyn, led by Loretta E. Lynch, did not believe they could win in court and balked at bringing charges.

Once Lynch succeeded Holder as attorney general in April 2015, however, Vanita Gupta, the head of the civil rights division, and her lawyers convinced Lynch that the officers had very likely violated Garner’s civil rights.

Lynch allowed the civil rights division to take a lead role in the case, and the following September the department replaced the FBI agents and prosecutors who had been working on the case with a new team from outside New York.

The two sides disagreed over whether the widely published video of Garner’s arrest proved that Pantaleo had acted wrongfully. Prosecutors in Washington accused their colleagues in Brooklyn of mishandling the investigation.

The case stalled again after Trump won the presidential election and appointed Jeff Sessions as his attorney general. Civil rights division prosecutors recommended to the deputy attorney general, Rod Rosenstein, that charges be brought, but he declined to move forward.

As the Russia investigation engulfed the department and Sessions was fired, the case languished until Barr took it up.

To the bitter end, prosecutors on both sides of the debate lobbied Barr in a series of briefings; and Barr reviewed the video multiple times, officials said.

But it remains unclear if prosecutors interviewed Pantaleo, which would have helped establish his state of mind and intent when he put Garner into a hold. When asked whether prosecutors had interviewed the officer, a Justice Department official would say only that the department had access to “statements relevant to that analysis.”

Barr, in the end, sided with prosecutors in New York.

But it is ultimately up to Commissioner James P. O’Neill, as the final arbiter of police discipline, to decide whether to fire Pantaleo or punish him in some other way.

But O’Neill will not make a formal decision until the police administrative judge who oversaw a disciplinary trial that ended in June renders her verdict, a spokesman for the department, Philip T. Walzak, said in a statement.

Pantaleo, 34, has been on desk duty without a shield or a gun since Garner died, a status that has allowed him to accrue pay and pension benefits.

Sen. Kirstin Gillibrand, D-N.Y., called the Justice Department’s decision an “outrage” and said the Police Department “must make their departmental findings fully transparent to the public and take immediate actions to ensure this officer is no longer on the force.”

Garner, who was 43, died on a Staten Island sidewalk July 17, 2014, after Pantaleo wrapped an arm around his neck from behind and took him to the ground. Other officers put their weight on him, compressing his chest against the pavement.

The officers had been ordered to arrest him for selling untaxed cigarettes, and he had resisted. A medical examiner testified at the disciplinary hearing that the pressure on Garner’s neck and chest set in motion a fatal asthma attack.

Federal prosecutors did a “rigorous analysis” of the event, but in the end they did not believe they had enough evidence to prove beyond a reasonable doubt that Pantaleo had committed a crime, a senior Justice Department official said Tuesday, speaking on the condition of anonymity because he had not been authorized to speak on the record.

To prove criminal conduct, the official said, the government had to convince a jury that in the middle of a dynamic arrest, Pantaleo made a clear decision to apply a chokehold, which the Police Department had banned more than two decades ago. It was a burden prosecutors did not believe they could meet.

None of the New York officers involved in Garner’s death have been charged with a crime or disciplined by the Police Department. That fact has enraged the Garner family and various advocacy groups devoted to holding the police accountable for abuses of power.

The state grand jury declined to bring charges against Pantaleo in December 2014, after the police officer testified in his own defense that he did not put Garner into a chokehold, and that he feared that he would be pushed through a storefront window during the struggle.

The Justice Department said Tuesday that it had weighed four elements in deciding whether to charge Pantaleo, including whether he used unreasonable force, whether he willfully violated the law, whether he acted in his official capacity as a law enforcement professional and whether the other person was injured.

Donoghue said prosecutors did not believe they could prove he had intentionally used unreasonable force. Even if they could prove the officer had used force that was “objectively unreasonable,” the government would still have to show the officer did so “willfully,” a very high level of intent.

The Brooklyn prosecutors who studied the video of the incident concluded that Pantaleo did not initially intend to apply a chokehold, and that he eventually did so for seven seconds after the two men crashed to the ground, Donoghue said.

Donoghue also said that Pantaleo had released Garner from the chokehold before the dying man said “I can’t breathe,” and neither Pantaleo nor the other officers subduing him applied a chokehold after that point. In the end, he said, the video “does not establish beyond a reasonable doubt that Pantaleo acted willfully.”

This article originally appeared in The New York Times.