BAKU/YEREVAN (Reuters) - Azerbaijan and its breakaway region of Nagorno-Karabakh said they had halted hostilities on Tuesday after four days of intense fighting that had prompted fears of all-out war.

A soldier of the self-defense army of Nagorno-Karabakh carries weapons in Martakert province, which according to Armenian media was affected by clashes over the breakaway Nagorno-Karabakh region, April 4, 2016. REUTERS/Vahan Stepanyan/PAN Photo

Officials in Nagorno-Karabakh, an ethnic Armenian region that rejects Azerbaijan’s rule, said there was still some sporadic shooting but that the intensity of the fighting had dropped off significantly.

Several European countries had urged an end to the fighting, worried in part that it could cause instability in a region that serves as a corridor for pipelines taking oil and gas to world markets.

The ex-Soviet states of Azerbaijan and Armenia fought a war over the mountainous territory in the early 1990s in which thousands were killed on both sides and hundreds of thousands displaced.

The war ended with a truce in 1994, although there have been sporadic flare-ups since. The ceasefire was shattered over the weekend, with Azerbaijan’s army and the Armenian-backed separatists of Nagorno-Karabakh exchanging heavy fire using artillery, tanks, rocket systems and helicopters.

On Tuesday afternoon, military officials in Azerbaijan, and in the breakaway region, announced they had agreed to a ceasefire with immediate effect.

Colonel Vitaly Arastamyan, a deputy chief of military headquarters for the breakway administration, said that after the ceasefire came into force his forces were fired at periodically, but not as intensively as in previous days.

“This situation had been brewing since 2014, but what had happened during the last three days was a peak. It was the most serious aggravation of the situation since the 1994 ceasefire,” Arastamyan told Reuters in Nagorno-Karabakh’s capital, Stepanakert.

Azerbaijan’s Defence Ministry said it was observing the ceasefire. Reuters was not able independently to verify if either side had violated the truce.

Washington welcomed the truce. “It’s a very nascent ceasefire but we are encouraged that it does seem to have taken hold,” State Department spokesman Mark Toner said. “We’re actively engaging with both sides to urge them to strictly adhere to the ceasefire.”

Before the hostilities were halted, Azerbaijan said 16 of its servicemen had been killed in the previous 48 hours. Officials in the breakaway region said 29 of their soldiers had been killed since the fighting started, and another 101 wounded.

RISK OF ESCALATION

An all-out war over Nagorno-Karabakh could drag in the big regional powers, Russia and Turkey. Moscow has a defense alliance with Armenia, while Ankara backs its ethnic Turkic kin in Azerbaijan.

Slideshow ( 6 images )

Turkish Prime Minister Ahmet Davutoglu on Tuesday condemned what he said were Armenian attacks, and said Turkey would stand by Azerbaijan. Earlier, Russia’s foreign minister had said Ankara’s support for Baku was one-sided.

Nagorno-Karabakh is an enclave with a large ethnic Armenian population that lies inside the territory of Azerbaijan. The violence was a re-awakening of a long-festering ethnic conflict between the mainly Muslim Azeris and their Christian Armenian neighbors.

Envoys from Russia, France and the United States - who make up a body called the Minsk Group that mediates in the conflict - are planning to head to the region, French Foreign Minister Jean-Marc Ayrault said in Paris.

“We can see that military conflict cannot be the solution,” Ayrault told reporters after talks with his German counterpart Frank-Walter Steinmeier.

Russian President Vladimir Putin had spoken by phone to the leaders of Armenia and Azerbaijan and urged them to end the fighting, Kremlin spokesman Dmitry Peskov said.

Even if the ceasefire holds in the short-term, there is still potential for the fighting to flare again.

Anger and frustration are building in Azerbaijan that years of talks have failed to bring Nagorno-Karabakh under its control. The country has used revenues from exports of crude oil to build up its military, leading some Azeris to believe that if there was another war, they could win it.

Azerbaijan said its troops had seized small pockets of territory in the latest fighting, and were fortifying those locations to make sure that it held on to its gains.