(CNN) -- A Sudanese rebel group has signed a deal allowing access to its bases to ensure children are not being used as soldiers and to protect them from sexual violence, the United Nations said.
As part of the agreement Wednesday, the rebels pledged to release and hand over to the United Nations anyone under age 18 caught up in the Darfur conflict.
The Justice and Equality Movement rebels also agreed to release children "not directly associated" with the group but used by others in the conflict.
"It's taken more than two years to get here," said Nils Kastberg, Sudan representative for the United Nations Children's Fund, which signed the deal with the rebels.
In the deal, rebels vowed to stop the recruitment and use of child soldiers, including in noncombatant or supportive roles, the United Nations said. They also plan to end their killing, maiming and sexual violence of children.
Sudanese forces have clashed with the rebel group for years, most recently in May. The latest conflict was over a breach of a deal reached this year to cease hostilities, according to the United Nations.
Kastberg said the deal makes it easier to deliver supplies to children, who join armed groups to get basics such as food and water. He hoped it would be an incentive for other rebels in the region to protect minors.
"We gradually see that armed movements recognize that involving children has consequences ... [and that] there can't be impunity," Kastberg said.
United Nations officials estimate that 300,000 people have died in the past seven years and more than 3 million displaced as a result of fighting between rebels and government forces.
The Darfur conflict started when two rebel groups -- the Sudan Liberation Army and Justice and Equality Movement -- started attacking the government in 2003. The groups accused Khartoum of favoring Arabs and oppressing black Africans.
Government forces have been backed by the Janjaweed, a militia accused of murdering, raping, and burning homes in Darfur
Darfur, a province of Sudan, has suffered the worst humanitarian crisis in the world, according to the United Nations.