South Sudan's government and rebels agreed on Friday to withdraw troops from urban areas, a Sudanese official said, as they signed a security deal aimed at ending a four-and-a-half year war."All parties have agreed to withdraw military troops from urban areas as part of the security agreement," Sudanese chief of military intelligence Jamal Omar said at the signing ceremony in Khartoum. The agreement comes days after South Sudanese arch-foes President Salva Kiir and rebel leader Riek Machar agreed a permanent ceasefire, raising hopes of an end to the conflict that has devastated the world's youngest country.Friday's deal in the latest round of peace talks hosted by neighbouring Khartoum was signed at Sudan's defence ministry and attended by Machar, South Sudanese government officials and journalists.* Sign up to News24's top Africa news in your inbox: SUBSCRIBE TO THE HELLO AFRICA NEWSLETTER FOLLOW News24 Africa on Twitter and FacebookOmar said a security committee would also be set up to monitor the implementation of the deal, which allows the opening of humanitarian corridors to deliver aid."The security deal stipulates that there will be no military presence in churches, villages, schools and camps," he said.Sudanese Foreign Minister Al-Dierdiry Ahmed said the warring factions have also agreed to immediately free detainees."It's time for our brothers to put down their weapons," Ahmed said at the ceremony. He told AFP that the rival groups have also entered talks on power-sharing, the details of which would be discussed on Saturday in Kampala at a summit between Ugandan President Yoweri Museveni, Kiir and their Sudanese counterpart President Omar al-Bashir.'Significant progress'Two years after separating from Sudan in 2011, oil-rich South Sudan plunged into a war that has since killed tens of thousands of people and displaced four million, after Kiir accused his then-deputy Machar of plotting a coup.After several previous peace efforts failed and the UN threatened sanctions on the warring factions, East African leaders launched a new bid last month to end the war.An initial round of talks was held in Addis Ababa but it faltered, after which Bashir hosted the current round of dialogue in Khartoum.Kiir and Machar agreed a permanent nationwide ceasefire on June 27, signing what was dubbed the "Khartoum Declaration" in Bashir's presence.Although the rebels accused the South Sudanese army of breaking the ceasefire just hours after it came into force, sources say it has largely been observed, with no reports of fighting or clashes over the past four days."Significant progress has been made towards successful conclusion of discussions on all outstanding technical security issues," said Rajab Muhandis, a leading South Sudanese civil society activist attending the talks in Khartoum.The Khartoum talks are to be followed by negotiations in Nairobi after which a final round of talks is expected back in Addis Ababa.The conflict in South Sudan erupted in December 2013, dashing the optimism that had accompanied independence from Sudan.The war, fuelled by the deep enmity between Kiir and Machar, spread to several states and was characterised by ethnic massacres, attacks on civilians, widespread rape, the recruitment of child soldiers and other human rights violations.