Pakistan's foreign office has summoned the Iranian ambassador over an ultimatum by the head of Iran's armed forces that his country will attack areas sheltering "terrorists" in Pakistan unless it tightens control over its borders and stops what he calls cross-border attacks.

Major-General Mohammad Baqeri made the comments on Monday, nearly two weeks after 10 Iranian border guards were killed in clashes near Mirjaveh, a town near the Iran-Pakistan border.

Jaish ul-Adl (Army of Justice), a Sunni armed group fighting for independence in Iran's Sistan-Baluchestan province, claimed responsibility for the attack.

How much power does the Iranian president have?

It said it had shot the guards with long-range guns fired from inside Pakistan.

"We expect Pakistani officials to control the borders, arrest the terrorists and shut down their bases," Iran's FARS news agency quoted Baqeri as saying.

"If the terrorist attacks continue, we will hit their safe havens and cells, wherever they are."

On Tuesday Pakistan's foreign office said the comments went "against the spirit of brotherly relations".

"During the visit of the Iranian foreign minister [Mohammad Javad Zarif] to Islamabad on 3rd May 2017, the two sides agreed to enhance cooperation on the border issues," it said.

"The Iranian side was urged to avoid issuance of such statements that could vitiate the environment of fraternal relations."

Zarif visited Pakistan last week and asked Nawaz Sharif, the prime minister, to improve border security.

Pakistan assured Iran it would deploy additional troops along its border.

In 2014, Iran said it would send troops to Pakistan to retrieve five Iranian border guards kidnapped by Jaish ul-Adl.

READ MORE: Iran's election - It's not about moderates or hardliners

Pakistan said at the time that such action would be a violation of international law and warned Iranian forces not to cross the border.

Iran refrained from sending troops when a local religious leader stepped in and resolved the situation.

Four of the guards were released a few months later, but one was killed by Jaish ul-Adl.

Sistan-Baluchestan province has a long history of unrest with the mainly Sunni Muslim population complaining of discrimination at the hands of Iran's Shia Muslim authorities.

Source: News agencies