LOS ANGELES -- The Department of Justice has stepped in to free a man from detention by immigration authorities, telling a federal judge that the DOJ needs the man's help with an investigation.

The crime Edgar Arzate may have witnessed: his own savage beating at the hands of Santa Ana, California, police officers in June.

Arzate had been facing multiple felony charges and was detained for six weeks by immigration authorities. Now the state of California has dismissed all but one charge against him and his deportation proceedings have been put on hold -- an almost complete reversal that was set in motion just last week by the DOJ's Civil Rights Division.

On Monday, four charges, including resisting arrest and assault on one of the police officers involved in his beating, were dismissed in court. Arzate still faces one charge of felony attempted burglary.

On Oct. 1, Arzate was removed from immigration detention and arraigned on a federal warrant in Santa Ana. The warrant named him as a material witness to a crime under federal investigation and could make him eligible for an S visa, or what's known as a "snitch visa" in the immigration community.

The certification of Arzate as a material witness suggests the Justice Department has opened an investigation into the beating. It also allows him to apply for a U visa, a special immigration status granted to immigrants who are victims of a crime and cooperating with law enforcement in the pursuit of an investigation. A U visa requires law enforcement to certify that an immigrant is the victim of a crime, and such a designation is exceedingly rare when the alleged crime was committed by law enforcement itself. (A U visa can also be permanent, whereas an S visa leaves an immigrant vulnerable to deportation once the case is over.)

What makes the move by the Justice Department all the more remarkable is that Arzate is far from a model individual. Indeed, he has previously been deported twice and has served time in prison. By protecting Arzate, an undocumented immigrant, from deportation, the DOJ is upholding the principle that the Constitution and the rule of law apply to all people, no matter their prior record.

Arzate was picked up by Immigration and Customs Enforcement agents in August on his way to a hearing stemming from the beating he endured in June. Among other offenses, Arzate was charged with assaulting an officer, as one of the cops claimed to have broken his hand during the beating.

But the federal warrant issued for Arzate keeps him in the U.S. indefinitely, under the protection of the federal government.

No charges have been filed against any of the officers in Arzate's beating, which was caught on video by a nearby surveillance camera. During the beating, officers appear to notice the video camera and move the victim out of view -- and then they allegedly continued to attack him.

Calls to the Santa Ana Police Department were not immediately returned.

"The system is working as it should -- Edgar was falsely charged and removed off the streets before he exposed these erroneous charges," said Frank Bittar, a senior deputy public defender in Orange County representing Arzate. "It's really heartening to see that there are extraordinary people working for federal agencies that keep other authorities in check and are truly interested in unbiased justice."

Bittar has filed a formal complaint with the Justice Department.

On the evening of June 19, Arzate, who has struggled with drug addiction and mental health issues, went to what he thought was a friend's home in Santa Ana, apparently unaware that the friend no longer lived there, according to Bittar. The residents saw Arzate mumbling incoherently outside their house and called police.

Arzate ran when he saw the officers, leading them on a roughly four-block chase before he surrendered in the front yard of another home. In the video, Arzate can be seen lying facedown on the ground, as officers begin to beat him, punching, kicking and swinging a flashlight.

In August, Arzate was on his way to a preliminary court hearing to face related charges when three unmarked cars pulled him over, according to family members who were with him. ICE agents took Arzate into custody, putting him at risk of deportation.

Though he was brought to the country as a teenager, Arzate is not eligible to apply for deferment under the immigration program known as Deferred Action for Childhood Arrivals because he has previously been imprisoned on drug and auto theft charges. He has been deported twice before and re-entered the U.S.

Bittar, in his complaint to the DOJ, raised serious doubts about ICE's arrest of Arzate, alleging that the timing was "unusual and irregular."

"What a windfall it would be for a criminal defendant to be removed to his native country prior to answering to his charges first," the complaint reads. "But that is exactly what is taking place here. The only rational conclusion is that someone did not wish to allow Mr. Arzate to have his day in court. Had he been allowed to do so, he would have exposed a horrific civil rights violation perpetrated by rogue police officers."

Bittar alleges that the ICE officers who arrested Arzate and caused him to miss his court hearing in August were "most likely" acting on a tip from the Santa Ana Police Department.

The department's Cpl. Anthony Bertagna previously told HuffPost that ICE acted on its own. "We don't tip off ICE. We didn't know he had a court date," Bertagna said, adding, "Obviously if we wanted him arrested, we'd arrest him ourselves. When it comes to ICE and their jurisdiction and the laws they enforce, when we're asked to assist, we assist. We were not involved in ICE's action."

A spokesperson for ICE said that immigration authorities found Arzate on their own and that they routinely comb court records looking for undocumented immigrants with upcoming hearings.

In the complaint, Bittar argues that a federal investigation is Arzate's only hope of a fair inquiry into the beating.

"Local law enforcement cannot be trusted to investigate this matter," the complaint concludes. "Santa Ana police officers beat Mr. Arzate. The Orange County District Attorney's office filed serious charges against him despite the overwhelming evidence that he did not assault nor injure anyone. Indeed, Mr. Arzate was victimized by these officers."