Rouhani participated in Nowruz celebration along with the regional leaders including Pakistani President Mamnoon Hussain.
Rouhani said in his Nowruz address that Afghanistan has been occupied twice by foreign countries, a reference to the Soviet Union in the 1980s, and the U.S. and allied troops who ousted the Taliban.
Rouhani said the occupations by foreign forces have brought the unfortunate seed of violence in Afghanistan, which has damaged the lives of Afghan people and Afghanistan.
He said the Islamic Republic of Iran has condemned both occupations and has helped the people of Afghanistan in both periods of time.
Iran is one of the main opponents of the US-led invasion in Afghanistan and strongly opposes the long term presence of US forces in the country.
Tehran also opposed to a draft bilateral security agreement between Kabul and Washington that would keep US troops in Afghanistan for another decade.
Afghan president Hamid Karzai has so far refused to sign the bilateral security agreement which was endorsed by majority during the consultative Loya Jirga last year.
President Karzai insists that Washington should take practical steps towards his preconditions before he sign the security pact between.
Karzai demanded an immediate halt to US raids on Afghan homes and villages and resumption of peace talks with the Taliban group as his main conditions for the signing of the pact.