A cellphone video of an all-out brawl instigated by officers at a festival in Sunset Park led to the prosecution dropping charges against a man accused by police to have assaulted them and resisted arrest.

The disturbing video from September shows Officer Vincent Ciardiello hitting 22-year-old Jonathan Daza while the latter was restrained face-down on the ground. Almost as soon as the video hit the internet, the officer was suspended.

But it still took months for to get Daza and others arrested of cleared of any wrongdoing. From the Brooklyn Paper:

“In November, the [assistant district attorney] on the case put in an affirmation swearing on facts that clearly hadn’t happened, because there’s a video of the thing,” said Rebecca Heinegg, who represented Daza and his two sisters.

Police botched the criminal complaints against the Dazas and defendants Edwin Morales and Edwin Rosario by presenting the officer who testified against them as a witness to the events — even though he saw none of the actions he alleged — according to a Jan. 22 memo from the District Attorney’s Office.

Similarly, a document that an assistant district attorney filled out alleges that Daza had an altercation with the testifying officer, even though the two never interacted, the memo states.

A cellphone video of the scuffle proved the officer who testified against Daza was not a witness, Heinegg said.

Daza was arrested with two family members and two others who rushed to his aid at the time, but their fates are varied:

A grand jury declined to indict Cindy Daza, who was charged with assaulting a police officer, Heinegg said. Police later backpedaled, according to the Jan. 22 memo, claiming they meant to accuse Wendy Daza — not Cindy — of shoving an officer to the ground. Prosecutors told Heinegg they plan to drop charges against Wendy at her next court date in March, Heinegg said.

As of December, prosecutors from the DA’s office still thought they had a case. “It wasn’t until I submitted a motion and the video to the court and the ADA’s supervisors that they looked into it and came up with the memo,” Heinegg said.