(CNN) A federal judge in California late Tuesday ordered a halt to most family separations at the US border and the reunification of all families that have been separated in the first major rebuke to the Trump administration during ongoing furor over family separations at the border.

The court order specifically requires federal officials to stop detaining parents apart from their minor children, absent a determination the parent is unfit or the parent declines reunification; reunify all parents with their minor children who are under the age of 5 within 14 days and reunify all parents with their minor children age 5 and older within 30 days.

The order also mandates that officials provide parents contact with their children by phone within 10 days, if the parent is not already in contact with his or her child.

"Plaintiffs have demonstrated a likelihood of success on the merits, irreparable harm, and that the balance of equities and the public interest weigh in their favor, thus warranting issuance of a preliminary injunction," US District Court Judge Dana Sabraw wrote Tuesday.

The judge's order does not mean the Trump administration must stop prosecuting people who cross the border illegally.

Read More