US Attorney General Jeff Sessions has defended separating migrant children from their parents at the US border.

In a radio interview, he said that authorities "prefer to keep the children close" to their parents, but added that this was often not possible.

The issue has caused a growing storm after US officials confirmed hundreds of child migrants had been removed from their families.

On Tuesday, the UN called on the US to "immediately halt" the separations.

When asked whether it was "absolutely necessary" to separate children from their parents, Mr Sessions replied in the affirmative.

Speaking to conservative radio host Hugh Hewitt on Tuesday, he argued that many US children are taken away from their families if their parents are serving prison sentences.

Mr Sessions said migrant children were "being well taken care of".

"It's certainly not our goal to separate children, but I do think it's clear, it's legitimate to warn people who come to the country unlawfully bringing children with them that they can't expect that they'll always be kept together," America's top law officer said.

In early May, Mr Sessions announced that anyone found crossing the border illegally would be prosecuted and face possible separation from their children.

Previously, those crossing the border illegally for the first time were often charged with a misdemeanour offence, before often being released to face a court hearing. Most never turned up for those hearings, say Trump administration officials.

The UN Human Rights Office's spokeswoman Ravina Shamdasani criticised the policy on Tuesday and said that several hundred children, some as young as one, appeared to have been affected.

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

"The child's best interest should always come first, including over migration management objectives or other administrative concerns."

US Customs and Border Protection has confirmed that more than 650 children were separated from parents at the border over a fortnight in May.

US Ambassador Nikki Haley responded by accusing the UN of "hypocrisy" and said that "neither the United Nations nor anyone else will dictate how the United States upholds its borders".

President Donald Trump has tried to shift blame for family separations, claiming they were caused by bad legislation passed by Democrats.

However, a fact check by the Associated Press news agency found there was no law requiring families to be separated at the border and that it was a new policy from the Trump administration.

But the problem of children ending up in border immigration holding centres is not one that started with the current US administration.

Jon Favreau, a speechwriter for President Barack Obama, recently tweeted photos of young people being held in a chain-link fence enclosure at a facility in Texas, using the images to excoriate Mr Trump.

Mr Favreau apparently did not realise the images were taken in 2014 when his former boss, Mr Obama, was president.