A mother who was violently separated from her toddler by New York police in a widely viewed videotaped encounter agreed on Wednesday to do community service to resolve a separate legal case.

A judge told Jazmine Headley, 23, that the charges will be dropped in her credit card fraud case in New Jersey if she successfully completes an intervention program.

Judge Peter Warshaw said Headley will have to pay back about $1,000. Her agreement also includes 20 hours of community service.

"I'm just happy to be reunited with my son," Headley said outside the courthouse in Trenton.

Headley faced two credit card theft charges and one count of trafficking in personal information, along with two other defendants who were not in court Wednesday.

On Tuesday, Brooklyn District Attorney Eric Gonzalez dismissed the charges against Headley relating to the benefits office tussle, saying he was "horrified by the violence depicted" in a bystander's video. She left a New York jail later that day.

Mayor Bill de Blasio said it was "deeply troubling" and "100 percent unacceptable."

The incident in the benefits office did not come up during her court appearance in New Jersey.

The video captured the chaotic scene that unfolded last Friday as officers tried to remove Headley from the crowded office, where she had sat on the floor for two hours because of a lack of chairs.

Police were called when she refused a security guard's order to leave.

Headley ended up lying face-up on the floor during a tug-of-war over her 18-month-old son. Other clients shouted at the officers. At one point, an officer can be seen pulling her stun gun and pointing it at people in the angry crowd. Clients of the facility complained the episode was indicative of how the city treats social-services recipients.

"What happened to Jazmine Headley and her son Damone should never have happened," de Blasio, a Democrat, said Wednesday. "It will not happen again."

The New York Police Department and the Department of Social Services are reviewing the incident. Two city employees have been placed on modified duty. The police officers involved remain on full, active duty.

A police union representative said people should not rush to condemn officers, adding that the incident would have unfolded differently if those involved had complied with orders.

On Wednesday, Headley appeared briefly outside the courthouse with her mother, Jacqueline Jenkins, and attorney Brian Neary. She appeared to be holding back tears.

"I'm happy to have my daughter and my grandson back," Jenkins said.