JABRAYIL, Azerbaijan — Armenians and Azerbaijanis agreed on Tuesday to a cease-fire after four days of fighting along the border of a disputed region, putting to rest, at least for now, fears that the outbreak of ethnic strife might spiral into a wider war.

With almost palpable relief, mediators, including the United States, France and Russia, issued statements commending the halt in clashes along the line of contact of the Nagorno-Karabakh region, an ethnic Armenian enclave in Azerbaijan.

By Tuesday evening, the truce seemed to hold, though the Karabakh military reported isolated instances of mortar and tank fire from the Azerbaijani side.

In a statement, Azerbaijan’s Defense Ministry said that “on the basis of mutual agreement, the military actions on the contact line between Armenia and Azerbaijan are halted.”