Iran's president says a new joint security force will be formed with Pakistan to combat militants based along the two countries' shared border.

Hassan Rouhani said Tuesday that "a joint quick-reaction force for fighting against terrorism at the borders" was agreed to during his meeting with Pakistani Prime Minister Imran Khan a day earlier. Rouhani did not elaborate.

Both Pakistan and Iran say militant groups operate from bases on the other country's soil, occasionally carrying out deadly cross-border attacks.

The agreement comes after Pakistan's Foreign Ministry said Saturday that a group of militants crossed the border from Iran earlier that week and carried out a deadly attack against Pakistani armed forces in southwestern Baluchistan province, killing 14.

Rouhani also said he'll increase the volume of trade with Pakistan.