President Hasan Rouhani's landslide victory in the Presidential elections is good news for Iranians as well as for India.It should assist Iran to become more democratic, moderate and prosperous over time, but that is not a given.
His challenge is to overcome significant hurdles on his path, which arise from domestic politics, and an equally difficult challenge thrown up by the Donald Trump-led United States.
Rouhani came to power in August 2013 promising economic reform. Despite vast oil resources, Iran's economy has remained moribund because it has not been able to get technology to exploit its resources effectively, or exploit the market when oil prices were riding high.
He set about the process by working out the nuclear deal with the US and other Western powers so as to persuade them to lift sanctions, which badly affected the Iranian economy.
The sanctions have been lifted, but low oil prices are thwarting Iran's recovery. But the bigger problem is Iran's domestic politics. The country is, at best, a quasi-democracy.
Its system is structured so as to maintain the power of the clergy and their allies, the Islamic Revolutionary Guards Corps (IRGC).
At the top is Supreme Leader Ayatollah Ali Khamenei who has a veto on virtually everything.The legislature has two wings - the lower house or Consultative Assembly and the upper house, the Guardian Council.
Newly re-elected Iranian President Hassan Rouhani gestures during a televised speech after his victory in presidential election
The former is like a regular Parliament with legislators elected through secret ballot.
The latter has 12 members, of which half are clergy chosen by the Supreme Leader and the other half are jurists chosen by the lower house.
The Guardian Council has a veto on all legislations. The Supreme Leader is elected for life by an Assembly of Experts, a group of 88 top clergymen who are elected once in eight years through direct voting.
In addition, there is the powerful Expediency Council of some 30-40 people chosen by the Supreme Leader to assist him in managing the system.
Ebrahim Raisi, the candidate Rouhani defeated, is a former judge and was spoken of as a potential successor to the 78-year old Khamenei.
Both Rouhani and Raisi are clerics, and the latter has been a member of the Assembly of Experts since 2006.
Importance for India
The Iranian situation shows that elections alone do not make a democracy. The power of the Rouhani government is severely constrained at every step by the clergy. The IRGC, which is a parallel military organisation, complete with an army, navy and aerospace wings, have extensive business interests and serve as the storm troopers of the clergy.
They are involved in domestic repression, and support Assad's forces against the ISIS. Developments in Iran can have an important fallout in India.
Last year, oil imports hit record levels and Iran became the fourth biggest oil supplier to India.
This was because of the lifting of sanctions. Given its oil and gas resources and proximity to India, Iran's importance in the energy sector cannot be underestimated. But oil is not the only factor in India- Iran relations - connectivity is.
India has two projects in mind - the Chah Bahar port and related development scheme aimed at developing links to Central Asia and Afghanistan, and the International North South Transportation Corridor (INSTC) to connect western Indian ports through a multi-modal network to Europe via Iran.
During Prime Minister Narendra Modi's May 2016 visit, the two countries signed a $500 million (Rs 3,200 crore) agreement to develop the Chah Bahar port and fund a railway line to Zahedan.
Further India indicated its interest in building an LNG plant in Chah Bahar economic development zone.
New Delhi also returned $6 billion (Rs 3,900 crore), which was owed to Iran on the oil account during the sanction period.
The problem is that there are still rough edges to the India-Iran relationship. A deal to develop the Farzad B oil fields remains stuck.
Little or nothing has been done on the INSTC front, except the running of test cargoes to Russian destinations. Properly pursued it can be India's answer to China's One Belt One Road, which also aims to use Iranian routes and already exploits the Russian ones.
Given the potential Iran offers, India has reasons to worry about the US-Iran dynamics. Should relations deteriorate, India may once again be forced to curtail its Iranian commitments, just as it had to do in the 2007-2015 period.
Given New Delhi's compulsions to maintain good ties with the US, it would not like to buck Washington, and will thereby cede the ground to China which is unlikely to follow any new US lead in Iran.