A suicide car bombing followed by an armed assault killed at least two people and wounded dozens outside police headquarters in the port city of Chabahar in restive southeastern Iran on Thursday.
Iran's Foreign Minister Mohammad Javad Zarif accused "foreign-backed terrorists" of being behind the attacks and vowed to bring them to justice.
"Mark my words: Iran WILL bring terrorists and their masters to justice" Zarif tweeted.
Chabahar lies in Sistan-Baluchistan province which has long been a flashpoint, with Pakistan-based Baluchi separatists and Sunni Muslim extremists carrying out cross-border attacks targeting the Shiite authorities.
"This terrorist act led to the martyrdom of two members of the police force," the province's deputy governor in charge of security, Mohammad Hadi Marashi, told state television.
A total of 42 people were injured, the majority of whom were discharged from hospital by late afternoon, state television reported.
"The terrorists tried to enter Chabahar police headquarters but they were prevented by the guards and they detonated the car bomb," Marashi said without elaborating on how many assailants took part.
The gunmen who attempted to storm the building were killed by security forces, Iranian media reported.
Chabahar city governor Rahmdel Bameri said many shop owners and passers-by, including women and children, were seriously wounded.
"The explosion was very strong and broke the glass of many buildings close by," he told state television.
Chabahar lies some 100 kilometres (60 miles) west of the Pakistan border and is home to a large, mainly Sunni Muslim ethnic Baluchi community which straddles the two countries.
- Busy shopping district -
A resident contacted by AFP who said he was inside the police headquarters at the time of the assault said the assailants had attacked the building after blowing up the vehicle.
"There was an exchange of gunfire right after the explosion," the resident said, adding that it lasted about 10 minutes.
The police headquarters lies in a busy commercial district with many shops and banks around it.
The commander of the Islamic Revolution Guards Corps ground forces, Brigadier General Mohammad Pakpour, who has overseen counter-insurgency operations in the southeast, visited the police base after the attack, the ultra-conservative Tasnim news website reported.
The news agency carried pictures of the remains of the vehicle used by the attackers which is believe to have been a blue Nissan van.
There was no immediate claim of responsibility.
Several recent attacks in the province have been claimed by the jihadist Jaish al-Adl (Army of Justice), which is blacklisted as a terrorist group by Iran.
It was formed in 2012 as a successor to the Sunni extremist group Jundallah (Soldiers of God), which waged a deadly insurgency against Iranian targets over the previous decade.
In October, the group claimed the capture of 12 Iranian security personnel who were conducting an operation near the Pakistan border.
A state-run television news agency reported that the unit included intelligence agents from the Islamic Revolution Guards Corps.
Five of those captured were released and flown home last month following Pakistani intervention.
Chabahar is a strategically important city for Iran.
It has a deep-water port on the Gulf of Oman which, with Indian assistance, Iran has been developing as a major energy and freight hub between Central Asia and India, bypassing Pakistan.
Due to its importance as a trade gateway for landlocked Afghanistan, it is the only Iranian port exempt from sanctions imposed by the United States earlier this year after Washington pulled out of the landmark nuclear deal between major powers and Tehran.