He is the first Iranian President to have visited the Mecca Masjid.
Prime Minister Narendra Modi and Iran President Hassan Rouhani held "substantive and productive" talks and discussed cooperation in defence, trade, energy and regional issues, said Ministry of External Affairs Spokesperson Raveesh Kumar.
Acknowledging that India and Iran shared a similar history and culture with each other, President Rouhani said, "The relations between the two countries goes beyond trade and business, it goes back in history".
The port, which was inaugurated in December, has been touted as a way for India to establish trade routes that bypass its rival Pakistan.
Iran and India signed 14 memorandums of understanding (MOUs) on the sidelines of a meeting between Iran's President Hassan Rouhani and Indian Prime Minister Narendra Modi Feb. 17, Iran's state-run IRINN TV reported.
Nine pacts inked which includes one on double taxation avoidance.
"Shifting his focus on the global menace of terrorism, Rouhani said, "India and Iran have a common stance in effectively dealing with terrorism and extremism, and called for concerted regional efforts to deal with the challenge". India has committed $85 million for the development of the Shahid Beheshti Port.
Besides giving India access to Central Asia, the port will also help India counter China's regional influence.
"Both Iran and India respect each other".
The Prime Minister said the two countries wanted to see Afghanistan safe and prosper.
Calling the arrangement unfair, Rouhani said: "Today's foreign policy is about might and power". "It was noted that permission for the Iranian Pasargadbank to open a branch in India was under advance consideration".
The deal allows the Indian company to take over and run a part of Chabahar port's multi-purpose and container terminal for 18 months.
On the timelines, he said, "We agreed that next week the Indian team will come to Tehran for finalising some of the points".
On their vision for Afghanistan, the joint statement said both sides stressed that the "interests of peace and stability in the region are best served by a strong, united, prosperous, pluralisitic, democratic and independent Afghanistan while supporting the National Unity Government in the country".
China is now developing Gwadar port, in Pakistan, which also gives China a way into Africa. "If we are signing the pact then we will adhere to it, till the last breath", he said.
Since local gas prices in Iran are about $2.1 per mmBtu, India has asked for a stake in a producing oil field in Iran in addition to Farzad B to improve its average return on investment.
Modi and Rouhani will hold delegation-level talks later in the day following which a number of agreements are expected to be signed'. According to New Delhi, Iran has shifted the goalposts several times since the start of negotiations on the deal in 2007.