People participate in a protest against a recent U.S. immigration policy of separating children from their families when they enter the United States as undocumented immigrants, outside the Tornillo Tranit Centre, in Tornillo, Texas, June 17, 2018.

The Trump administration has reached a settlement stemming from the separation of immigrant children from their parents at the U.S. border that lets some 1,000 people affected by the policy apply again for U.S. asylum after previously being turned down.

The settlement, detailed in court documents late on Wednesday, represented a victory for rights groups that challenged President Donald Trump's contentious "zero tolerance" policy toward illegal immigrants entering the United States.

The settlement, which still needs a judge's approval, gives parents and children of immigrants a second chance to apply for asylum after U.S. authorities previously rejected their claims that they faced "credible fear of persecution or torture" if sent back to their home countries.

While about 2,500 children and parents were affected by the family separation that Trump later abandoned, more than 1,000 people will be eligible to apply again for asylum under the settlement, according to Muslim Advocates, one of the rights groups that sued the administration.

Under the plan, the administration said that while it did not plan to return any of the hundreds of parents who have already been deported, it would consider individual cases in which that may be warranted.

Trump's "zero-tolerance" immigration policy was aimed at discouraging illegal immigration, but the family separations and the detention of thousands of children, mostly from Guatemala, Honduras and El Salvador, prompted widespread condemnation. Trump ended the practice of family separations in June.

The settlement arose from three lawsuits brought by the American Civil Liberties Union, Muslim Advocates and the Hogan Lovells law firm, among others.

One lawsuit alleged that parents were suffering extreme trauma from the forced separation of their children and therefore failed "credible fear" interviews, which were their only opportunity to avoid expedited removal from the United States.

Under the settlement, these parents will now be able to submit additional evidence and testimony to make their case.

Sirine Shebaya, an attorney for Muslim Advocates, called the agreement a significant victory for the parents. "They will finally have a real chance to be heard and to secure safety and stability for themselves and their families," Shebaya said.

In May, Trump had sought to prosecute all adults crossing the border without authorization, including those traveling with children, but ended the family separations the next month.

Immigrants who choose not to agree to the settlement would be "promptly removed to their country of origin," according to the agreement put before U.S. District Judge Dana Sabraw in San Diego.

On Wednesday, the New York Times reported that the overall number of detained migrant children reached a total of 12,800 this month, citing data from members of Congress. Most of those children crossed the border alone, without their parents, the Times reported.