The president of Iran and the prime minister of Pakistan agreed on Monday to form a joint force to eliminate terrorists along their mutual border, state-owned media from both countries report.

The United States has designated Iran a state sponsor of terrorism and labeled a branch of its military, the Islamic Revolutionary Guard Corps (IRGC), a foreign terrorist organization. Washington has repeatedly accused Pakistan of harboring jihadis.

President Hassan Rouhani announced the agreement to form a Joint Rapid Reaction Force to guard their mutual border after meeting Prime Minister Imran Khan during his two-day visit to Tehran, during which the Pakistani leader allegedly pledged not to join any coalition against the Islamic Republic, Iran’s state-controlled Press TV notes.

“We agreed to step up security cooperation between the two countries and their respective border security and intelligence forces while also forming a joint rapid reaction force on the shared borders to fight terrorism,” Rouhani declared.

“Both sides agree that no third country whatsoever can affect the friendly and brotherly ties that exist between Iran and Pakistan,” he also said, likely referring to the United States and Tehran’s regional foe and Islamabad’s close ally Saudi Arabia.

Terrorism and border security dominated the talks between the leaders of neighboring Iran and Pakistan. The joint anti-terror force announcement came soon after both countries accused terrorists operating in Iran and Pakistan of attacking members of their respective militaries.

Iran has accused the Pakistan-based Sunni extremist group Jaish al-Adl of killing at least 27 IRGC troops by ramming an explosive-laden vehicle into their bus near the Iran-Pakistan border, marking one of the deadliest assaults on the Iranian force, according to Radio Free Europe/Radio Liberty (RFE/RL).

“Unfortunately we witnessed some tensions in border areas in the recent past, where terrorists perpetrated their nefarious acts,” Rouhani proclaimed on Monday.

Over the weekend, Islamabad accused Iran-based terrorists of killing 14 Pakistani troops in volatile Balochistan, RFE/RL notes.

During his visit to Tehran, Khan proclaimed that terrorism incidents plague the relationship between the two countries.

Khan told reporters he fears terrorism could become “a divisive part of the two countries’ bilateral relations and increase differences between the countries,” Pakistan’s Dawn newspaper reports.

The most important agenda item for his visit to Iran was “the issue of terrorism,” PM Khan declared.

Khan suggested that the Pakistani “security chief” will meet with his Iranian counterpart and discuss ways to cooperate so that both countries “reach a level of trust such that both countries will not allow any terrorist activity from their soil.”

“We hope that this will build confidence between us; it will help build a future relationship where we have complete confidence in each other,” the prime minister added.

Pakistan maintains a close relationship with Iran’s regional rival Saudi Arabia and to a lesser extent with the United States.

In retaliation, Iran has deemed U.S. Central Command (CENTCOM) — charged with overseeing American military activities in the Middle East — a terrorist group.

It is unclear whether the Iran-Pakistan joint task force will target U.S. troops considered terrorists by Tehran.

Press TV acknowledges that the two leaders discussed U.S. President Donald Trump’s decision to label the IRGC a terrorist group, without elaborating further.

PM Khan repeated his assertion that no terrorist group would be allowed to operate in Pakistan. In March, the U.S. military acknowledged that Islamabad has begun to take some action against terrorists operating on its soil.

Khan also said Iran and Pakistan will cooperate to achieve peace in neighboring Afghanistan. The Pentagon has accused both Iran and Pakistan of backing the Taliban. Pakistan and the heavily U.S. sanctioned Iran also discussed ways to improve their economic relationship.