(Reuters) - A federal judge on Friday approved a plan to reunite hundreds more families who were separated by border officials after they entered the United States from Mexico.

Slideshow ( 3 images )

The plan negotiated by the U.S. government and immigrant rights advocates marked the second stage of federal efforts to reunite 2,551 children ages 5 to 17 with their parents.

These families had been separated under President Donald Trump’s now-abandoned “zero tolerance” policy toward illegal immigrants.

As of Thursday, 541 of the children remained separated and under care of the Office of Refugee Resettlement, while another 24 under age 5 also remained in federal care. More than 2,000 children have already been reunited with their parents.

The plan sets out processes to locate parents outside the country, assess their fitness as parents, and determine their intentions for their children.

It also includes provisions negotiated this week, including that the government arrange travel for reunited children and not impair their right to seek future asylum.

“The joint proposed plan is approved wholeheartedly by the court,” U.S. District Judge Dana Sabraw said at a hearing in San Diego attended by U.S. Department of Justice and American Civil Liberties Union lawyers.

Trump abandoned the separation policy on June 20 after widespread criticism at home and internationally.

Sabraw said he would reserve judgment on a disputed issue of whether removed parents could be reunited with their children in the United States, instead of their original countries, including parents who may want asylum for their children.

Sabraw has been overseeing the reunification process since ordering on June 26 that families be reunited.

In a related case, Sabraw on Thursday put an indefinite freeze on deporting families who were separated at the border, including those who have been reunited.

Lawyers for the families had argued that some parents may have unknowingly waived their reunification rights, and that children have a right to their parents’ help in seeking asylum.

Sabraw, who was appointed to the bench by President George W. Bush, on Friday acknowledged the challenges in efficiently bringing parents and children back together.

“This is an enormous undertaking involving a situation of the government’s own making, but we will never be able to come up with a process that is perfect or restores all rights, as if this incident never happened,” he said. “All we can do is the best we can do under the present circumstances.”