Armed groups in Central African Republic have agreed to release any children they are holding and not to recruit child soldiers, the United Nations Children's Agency said Tuesday.

Eight groups, including the Christian anti-Balaka militia and some ex-Seleka rebel groups, made the commitment in the capital, Bangui, the U.N. said. Representatives of the two warring factions had made a similar pledge in February while signing an unconditional cease-fire during mediations in Nairobi, Kenya.

"Children are the principal victims of this conflict," said U.N. Children's Agency representative Mohamed Malick Fall, who said many worked on the initiative to get the armed groups to agree to liberate the child soldiers. The challenges will be rehabilitating the children and getting them back into the community, he said.

UNICEF said between 6,000 and 10,000 children have been recruited by armed groups in Central African Republic.

"We pledge to respect our signature so that the Central African children can enjoy the same life chances as their peers around the world," said Abel Balinguele, a spokesman for one of the ex-Seleka groups.

The agreement was signed during a week-long forum in the capital, Bangui, where politicians, civil society groups and others have gathered to discuss the country's future.

Central African Republic was hit by unprecedented sectarian violence last year when the Christian anti-Balaka militia was formed to combat the mostly Muslim Seleka rebels, who had taken control of the country.

The conflict has affected children in Central African Republic in many ways. Prosecutors and military authorities are investigating accusations that French soldiers sexually abused boys in 2013 and 2014 in the former French colony when France launched a military operation to quell the sectarian violence. French soldiers sexually abused boys as young as nine years old, residents of a refugee camp told The Associated Press. The allegations became public last week.