Iran has warned that renewed fighting between its neighbours Azerbaijan and Armenia could escalate into a wider regional war.
President Hassan Rouhani said he hoped to "restore stability" to the region following days of heavy clashes over the disputed Nagorno-Karabakh enclave.
The enclave is officially part of Azerbaijan but run by ethnic Armenians.
The current fighting is the worst seen in decades, and both sides have blamed each other for the violence.
"We must be attentive that the war between Armenia and Azerbaijan does not become a regional war," President Rouhani said on Wednesday.
"Peace is the basis of our work and we hope to restore stability to the region in a peaceful way," he added.
President Rouhani also said it was "totally unacceptable" for any stray shells and missiles to land on Iranian soil.
His comments followed reports that shells had landed on villages in Iran, just across from its northern border with Armenia and Azerbaijan.
"Our priority is the security of our cities and villages," President Rouhani said.
Iranian Border Guards Commander Qasem Rezaei also said his forces had been placed "in necessary formation" across from the fighting.
"Since the beginning of the conflict... a number of artillery shells and rockets have hit the territory of [Iran]," he said, according to the Tasnim news agency.
"Our border guards are vigilant and have moved into the necessary formation. They are fully monitoring and controlling the borders."
What else is happening?
On Wednesday, Russian President Vladimir Putin called for an end to the fighting, which he described as a "tragedy".
"We are very concerned," he said in a televised interview. "We hope that this conflict will end in the very near future.
"People are dying [and] there are heavy losses on both sides."
Mr Putin also held a brief telephone call with Azerbaijan's President Ilham Aliyev on Wednesday, the Kremlin said.
Russia is part of a military alliance with Armenia and has a military base in the country. However, it also has close ties to the government of Azerbaijan.
The US, France and Russia have jointly condemned the fighting in Nagorno-Karabakh and have called for peace talks, but the conflict shows no signs of abating.
On Wednesday Azerbaijan said Foreign Minister Jeyhun Bayramov would meet international mediators in Geneva on Thursday.
Armenia responded that it was "impossible to hold negotiations with one hand and continue military operations with the other", and that its foreign minister would not meet Mr Bayramov in Geneva.
Armenia's Zohrab Mnatsakanyan is however due in Moscow for talks next week.
Cities rendered ghost towns by conflict
Analysis by Orla Guerin in Tartar, Azerbaijan
Azerbaijan says it is continuing to advance around the long-disputed region of Nagorno-Karabakh. It has more fire power, and more sophisticated weaponry.
For now it appears to have the upper hand, but areas near the frontline are within range of shelling by ethnic Armenian forces.
The city of Tartar - which borders Nagorno-Karabakh - has become a ghost town. Normally it is home to 100,000 people but most appear to have fled.
The main street is empty and is littered with broken glass and shrapnel. Shopfronts have been blown out, and roofing ripped off.
We found a handful of families sheltering below ground. One elderly woman - whose son and daughter are fighting with Azerbaijani forces on the frontline - told us she was waiting for victory and would never leave.
Her seven-month-old grandson was nestled in her arms and didn't flinch at the sound of incoming fire. "He's used to it," she explained.
What's the latest from the battlefield?
The clashes have displaced half of Nagorno-Karabakh's population - about 70,000 people - the region's human rights ombudsman Artak Beglaryan told AFP news agency.
The main city in Nagorno-Karabakh, Stepanakert, has been hit by several days of shelling. Residents have been taking shelter in basements and much of the city has been left without power.
There were fresh strikes on Wednesday morning and smoke was seen around Stepanakert, AFP reports.
Meanwhile, Azerbaijan accused ethnic Armenian forces of shelling urban areas and targeting civilian buildings.
Its second-largest city, Ganja, has been shelled and Azerbaijani officials said hundreds of buildings were destroyed.
At the weekend the International Committee of the Red Cross condemned "reported indiscriminate shelling and other alleged unlawful attacks". It also said "scores" of civilians had been killed.
More than 300 people have died since the clashes began on 27 September.
But there are fears the actual death toll among military forces from all sides as well as civilians could be much higher, as casualty claims have not been independently verified.
Nagorno-Karabakh - key facts
- A mountainous region of about 4,400 sq km (1,700 sq miles)
- Traditionally inhabited by Christian Armenians and Muslim Turks
- In Soviet times, it became an autonomous region within the republic of Azerbaijan
- Internationally recognised as part of Azerbaijan, but majority of population is ethnic Armenian
- Self-proclaimed authorities are not recognised by any UN member, including Armenia
- An estimated one million people displaced by war in 1988-94, and about 30,000 killed
- Separatist forces captured some extra territory around the enclave in Azerbaijan
- Stalemate has largely prevailed since a 1994 ceasefire
- Turkey openly supports Azerbaijan
- Russia has a military base in Armenia