A deal has been agreed to end weeks of violence in Sudan's South Kordofan state, where northern troops have been accused of ethnic cleansing. Rebels who fought for the south during Sudan's long civil war are to be either integrated into the northern army or disarmed.