(CNN) There are still 171 children from separated families in US custody more than four months after a judge ordered the US government to reunite the undocumented immigrant families it had split up at the border, according to court documents filed Thursday.

Of the children who remain in custody, there are seven who are in the pipeline to reunite with their parents in their countries of origin, according to the court documents, and six who the US government is working to discharge to parents in the US.

But 146 of the kids from separated families who remain in custody -- more than 85% -- will not be reunified with their parents either because the parents have declined reunification or because officials have deemed it cannot occur because the parents are unfit or pose a danger, officials said.

The new numbers appear in the latest federal court filing in the American Civil Liberties Union class action case over family separations.

JUST WATCHED John Oliver slams Trump over family separation Replay More Videos ... MUST WATCH John Oliver slams Trump over family separation 01:40

In June, US District Judge Dana Sabraw ordered the government to reunite most of the families it had divided , comprising parents and children who had been separated as a result of the government's now-reversed "zero tolerance" policy at the border and some separations that had occurred before that policy was put in place.

Read More