* Two sides strike ceasefire deal after marathon talks
* Both swiftly accuse each other of violating the truce
* Moscow brokered the deal at Putin's behest
* Idea is to allow them to swap prisoners, bodies of dead
* Both agreed in Moscow to start peace talks (Adds Russian foreign ministry, details)
By Nvard Hovhannisyan and Nailia Bagirova
YEREVAN/BAKU, Oct 10 (Reuters) - Armenia and Azerbaijan accused each other of swiftly and seriously violating the terms of a ceasefire in Nagorno-Karabakh on Saturday, raising questions about how meaningful the truce, brokered by Russia, would turn out to be.
The ceasefire, clinched after marathon talks in Moscow advocated by President Vladimir Putin, was meant to halt fighting to allow ethnic Armenian forces in Nagorno-Karabakh and Azeri forces to swap prisoners and war dead.
The Moscow talks were the first diplomatic contact between the two since fighting over the mountainous enclave erupted on Sept. 27, killing hundreds of people.
The enclave is internationally recognised as part of Azerbaijan, but is populated and governed by ethnic Armenians.
Within minutes of the truce taking effect from midday, both sides accused each other of breaking it.
The Armenian defence ministry accused Azerbaijan of shelling a settlement inside Armenia, while ethnic Armenian forces in Karabakh alleged that Azeri forces had launched a new offensive five minutes after the truce took hold and killed two civilians.
Azerbaijan said enemy forces in Karabakh were shelling Azeri territory and that one civilian had been killed. Both sides have consistently denied each others' assertions in what has also become a war of words accompanying the fighting.
Azeri President Ilham Aliyev told Russia's RBC news outlet the warring parties were now engaged in trying to find a political settlement, but suggested there would be further fighting ahead.
"We'll go to the very end and get what rightfully belongs to us," he said.
Azeri Foreign Minister Jeyhun Bayramov said the truce would last only for as long as it took for the Red Cross to arrange the exchange of the dead.
Speaking at a briefing in Baku, he said Azerbaijan hoped and expected to take control of more territory in time.
Armenia's foreign ministry said it was using all diplomatic channels to try to support the truce, while Nagorno-Karabakh's foreign ministry accused Azerbaijan of using ceasefire talks as cover to ready military action.
'RUSSIA CANNOT AFFORD TO STEP BACK'
Russian Foreign Minister Sergei Lavrov, who had mediated over 10 hours of talks, said in a statement early on Saturday the ceasefire had been agreed on humanitarian grounds.
The International Committee of the Red Cross said it stood ready to facilitate the handover of bodies of those killed in action and the simultaneous release of detainees.
Lavrov said Armenia and Azerbaijan had also agreed to enter into what he called substantive peace talks.
Those talks would be held under the auspices of the Organization for Security and Co-operation in Europe's (OSCE) Minsk Group, he said. The group is co-chaired by France, Russia and the United States.
Azerbaijan has said it wants a change in the talks' format, has spoken of wanting to get Turkey involved too, and on Saturday accused France of not being a neutral mediator.
Lavrov spoke to the Armenian and Azeri foreign ministers by phone on Saturday, the Russian foreign ministry said. Moscow said both sides have reaffirmed their commitment to the ceasefire agreement and the necessity of strictly enforcing it on the ground.
Putin spoke to Iranian President Hassan Rouhani by phone on Saturday about the deal, the Kremlin said. Iranian Foreign Minister Mohammad Javad Zarif said on Twitter the deal was a step towards peace.
Dmitri Trenin, director of the Carnegie Moscow Center and a former colonel in the Russian army, said on Twitter any peace talks were likely to fail and that Azerbaijan would continue to press for Armenian forces to leave the enclave, something Armenia would not accept.
Russia could not afford to step back, he said.
"For Russia, the most important issues in the South Caucasus are the security of Russian borders from jihadis coming from the Middle East and elsewhere, and Turkey's rising role in the region," wrote Trenin.
"This means that Moscow can't walk away from the Nagorno-Karabakh conflict and allow a war to rage".
Renewed fighting in the decades-old conflict has raised fears of a wider war drawing in Turkey, a close ally of Azerbaijan, and Russia, which has a defence pact with Armenia.
The clashes have also increased concern about the security of pipelines that carry Azeri oil and gas to Europe.
The fighting is the worst since a 1991-94 war that killed about 30,000 people and ended with a ceasefire that has been violated repeatedly.
Turkey welcomed the ceasefire deal but said much more was needed.
"The humanitarian ceasefire is a significant first step but will not stand for a lasting solution," the Turkish foreign ministry said in a statement. "Turkey will continue to stand by Azerbaijan in the field and at the table".
The Azeri and Turkish foreign ministers also spoke by phone on Saturday.
(Additional reporting by Maria Tsvetkova in Moscow and Margarita Antidze in Tbilisi, Ezgi Erkoyun in Turkey and John Irish in Paris Writing by Andrew Osborn Editing by Ros Russell, Frances Kerry and Chris Reese)
Our Standards: The Thomson Reuters Trust Principles.