After more than forty days of combat, the two countries reached an agreement mediated by Russia to end the war.