WASHINGTON - The Trump administration defended Tuesday its policy of separating illegal immigrant children from their parents as the United Nations demanded a halt to the "serious" violation of children's rights.

President Donald Trump, who ordered border patrol agents a month ago to implement the separation policy to deter other migrants from crossing the border, blamed it on opposition Democrats, as criticism mounted domestically and internationally.

"Separating families at the Border is the fault of bad legislation passed by the Democrats. Border Security laws should be changed but the Dems can't get their act together!" he said via Twitter.

Attorney General Jeff Sessions said the "zero tolerance" policy was legal and necessary to deter the thousands of families crossing the border and asking for asylum each month.

"We've got to get this message out. You will be prosecuted if you come illegally. And if you bring children, you'll still be prosecuted," he told conservative radio host Hugh Hewitt.

"If people do not want to be separated from their children, then they should not bring them with them."

Their comments came after the United Nations urged Washington to "immediately" halt the policy.

"The practice of separating families amounts to arbitrary and unlawful interference in family life, and is a serious violation of the rights of the child," said Ravina Shamdasani, spokeswoman for the UN Human Rights Office in Geneva.

"The use of immigration detention and family separation as a deterrent runs counter to human rights standards and principles," she said.

"Detention is never in the best interests of the child and always constitutes a child rights violation."

US envoy to the United Nations Nikki Haley blasted back, saying the body "shows its hypocrisy by calling out the United States while it ignores the reprehensible human rights records of several members of its own Human Rights Council." "We are also a sovereign country, with laws that decide how best to control our borders and protect our people," she said.

Since October, US border officials have taken several hundred children from their parents after they crossed the border, apparently reuniting most after several weeks.

It is unclear, however, what has happened since the announcement in early May that all illegal border crossers, even those seeking asylum, would be first placed under arrest and charged with a crime.

The administration says the harsh policy is necessary to stifle illegal immigration, amid a flood of migrants from Central America - mainly El Salvador, Guatemala and Honduras - fleeing constant violence.

"You can't be giving immunity to people who bring children with them, recklessly, and improperly, and illegally," Sessions said.

"Many of them have no legitimate claim at all. They are just coming because they would like to make more money, or for some economic reason. "We need to get this border under control."

But lawmakers and social groups say the separation policy has gone too far.

Democratic Senator Jeff Merkley, who visited holding facilities for the immigrants last week, said the policy inflicts "trauma" on the children.

He said the children are being kept in open fenced units that resembled "dog kennel-style cages," and given "nothing but space blankets" to protect them.

"There is no need to separate them from their parents while they await asylum," he told journalists. "This is not a zero tolerance policy. This is a zero humanity policy."

But Sessions said that the new policy of arresting border crossers mandates separating families.

"The law requires us to keep children in a different facility than one for adults," he told Hewitt.

"It is... always tough to separate children from their parents, of course. But it happens, sadly, every day when people go to jail in America."