South Sudan's government and rebels signed a ceasefire Thursday to end more than five weeks of fighting that divided Africa's newest nation and brought it to the brink of civil war. U.S. President Barack Obama, U.N. Secretary-General Ban Ki-moon and the U.N. Security Council welcomed the news, but several diplomatic sources in New York said they were worried the killing could continue. Fighting between troops loyal to President Salva Kiir and those backing the vice president he sacked in July, Riek Machar, erupted in mid-December. Thousands of people have been killed and more than half a million people have fled their homes, prompting the regional grouping of nations, IGAD, to initiate peace talks. More than 70,000 people have sought refuge at U.N. bases around the country after peacekeepers, in an unusual move, opened their gates to them. The pact is expected to be implemented within 24 hours of the signing, mediators said. But making the ceasefire hold could test Machar, whose forces include loyalists as well as more autonomous groups battling the centrally controlled government forces. "The crisis that gripped South Sudan is a mere manifestation of the challenges that face the young and fledgling state," Seyoum Mesfin, IGAD's chief mediator, told the signing ceremony. "I believe that the postwar challenges will be greater than the war itself. The process will be ... unpredictable and delicate." Obama said on Thursday the ceasefire was a "critical first step" toward peace in South Sudan, but added that leaders needed to work to resolve the underlying causes of the conflict, and must quickly release political detainees. "South Sudan's leaders must demonstrate their sustained commitment to a peaceful resolution of the crisis," Obama said in a statement, urging that "individuals who have committed atrocities are held to account." Sources told Reuters earlier this month the United States was weighing targeted sanctions against South Sudan because of the failure of the country's leaders to take steps to end the crisis. A delegate from Jordan, president of the 15-nation Security Council this month, told reporters in New York that the council welcomed the ceasefire and urged both sides to support and cooperate with the U.N. peacekeeping mission UNMISS, which has been the subject of sharp criticism from Kiir's government. U.N. chief Ban's press office issued a statement urging both sides to implement the ceasefire agreement immediately. It said Ban "underscores the necessity to continue without delay a national political dialogue to reach a comprehensive peace agreement, with the participation of all South Sudanese political and civil society representatives." Several diplomats expressed concern that the conflict could continue. "Ethnic, personal grievances, vengeance will dominate tit-for-tat actions, crimes, killings for some time," a senior diplomatic source told Reuters on condition of anonymity. South Sudan won its independence from Sudan in 2011 after decades of conflict between the northern and southern Sudanese.