The leaders of Armenia, Azerbaijan, and Russia have signed an agreement to end six weeks of military conflict over the breakaway region of Nagorno-Karabakh, triggering a political crisis in Armenia where angry protesters stormed government buildings and parliament.