Rouhani and other regional leaders joined Afghanistan's Hamid Karzai in Kabul today in celebrating the Persian New Year, Nowruz.
Rouhani says Afghanistan has been occupied twice by foreign countries a reference to the Soviet Union in the 1980s, and the US and allied troops who ousted the Taliban.
He says "they brought violence and extremists to this country."
Iran opposes a security agreement that would allow thousands of foreign forces to stay in Afghanistan beyond the end of 2014.