He was a key player in the deal that ended 21 years of civil war between rebels in southern Sudan and the Khartoum government .