The United States has the world's highest rate of children in detention, including more than 100,000 in immigration-related custody that violates international law, the author of a United Nations study said on Monday.

Worldwide more than 7 million people under age 18 are held in jails and police custody, including 330,000 in immigration detention centres, independent expert Manfred Nowak said.

Children should only be detained as a measure of last resort and for the shortest time possible, according to the United Nations Global Study on Children Deprived of Liberty.

"The United States is one of the countries with the highest numbers - we still have more than 100,000 children in migration-related detention in the (U.S.)," Nowak told a news briefing.

"Of course separating children, as was done by the Trump administration, from their parents and even small children at the Mexican-U.S. border is absolutely prohibited by the Convention on the Rights of the Child. I would call it inhuman treatment for both the parents and the children."

There was no immediate reaction from U.S. authorities. Novak said U.S. officials had not replied to his questionnaire sent to all countries.

He said the United States had ratified major international treaties such as those guaranteeing civil and political rights and banning torture, but was the only country not to have ratified the pact on the rights of children.

"The way they were separating infants from families only in order to deter irregular migration from Central America to the United States to me constitutes inhuman treatment, and that is absolutely prohibited by the two treaties," said Nowak, a professor of international law at the University of Vienna.

The United States detains an average of 60 out of every 100,000 children in its justice system or immigration-related custody, Nowak said, the world's highest rate, followed by countries such as Bolivia, Botswana and Sri Lanka.

Mexico, where many Central American migrants have been turned back at the U.S. border, also has high numbers, with 18,000 children in immigration-related detention and 7,000 in prisons, he said.

The U.S. rate compared with an average of five per 100,000 in Western Europe and 14-15 in Canada, he said.

At least 29,000 children, mainly linked to Islamic State fighters, are held in northern Syria and in Iraq - with French citizens among the biggest group of foreigners, Nowak added.

Even if some of these children had been child soldiers, he said, they should be mainly treated as victims, not perpetrators, so that they could be rehabilitated and reintegrated in society.