Afghan President Hamid Karzai agreed on a cooperation pact with Iran, despite continuing to resist signing a security agreement with the U.S., Reuters reported. 
Karzai made the deal with Iranian President Hassan Rouhani in Tehran Sunday.
"Afghanistan agreed on a long-term friendship and cooperation pact with Iran," Karzai's spokesman Aimal Faizi said, according to Reuters. "The pact will be for long-term political, security, economic and cultural cooperation, regional peace and security."
Afghanistan signed a cooperation pact with Iran in August covering mainly security issues, but Faizi said the proposed new agreement would have a broader scope.
Rouhani said Sunday his country opposes the presence of foreign forces in Afghanistan and the region, saying their presence generates tension, the official IRNA news agency reported.
IRNA quoted Rouhani as telling Karzai: "We believe that all foreign forces should leave the region and that the security of Afghanistan should be handed over to people of the country."
"We are concerned about tensions caused by foreign forces' presence in the region," Rouhani was quoted as saying. He also called for more cooperation between Tehran and Kabul. 
Iran has long opposed a planned agreement to allow U.S. forces to remain stationed on its doorstep in neighboring Afghanistan. The two countries have about 580 miles of common borders.
Rouhani also said Iran opposes any foreign forces in the region, the Middle East and the Persian Gulf, where the U.S. Navy's Fifth Fleet has a base in the tiny kingdom of Bahrain.
On Saturday, U.S. Defense Secretary Chuck Hagel laid out steps to beef up defense cooperation between states within the Gulf region, while at the same time insisting that America's military commitment to the Middle East will continue.
In a speech Saturday to Gulf leaders he also made it clear that the emerging global agreement that would limit Iran's nuclear program doesn't mean the security threat from the Islamic republic is over.
Iran's Defense Minister Gen. Hosein Dehghan called the remarks by his American counterpart "threatening" on Sunday, adding that they pave the ground for mistrust toward the U.S. while revealing the influence of Israel -- Iran's arch enemy -- on Washington.
Iran believes that countries of the Gulf are capable of managing security through regional security pacts.
Iran signed an interim agreement over its nuclear plan with world powers last month. Rouhani has been trying to convince skeptics and hard-liners at home that the move was not compromising on key issues of national sovereignty.
Israel has repeatedly criticized the deal and called it a "historic mistake," saying economic sanctions must be toughened, not eased.