Rivals sign 'lasting' ceasefire agreement