DUBAI - Iran's presidential election candidates clashed over foreign policy in their last televised debate on Friday, with a hardline frontrunner saying a moderate contender had undermined the country through past subservience to Western powers.

The June 14 presidential vote will be the Islamic Republic's first since the 2009 re-election of Mahmoud Ahmadinejad that led to months of unrest by backers of the losing reformist side who said his victory was rigged. Two reformist leaders have been under house arrest since 2011.

With the field narrowed to largely hardline conservative candidates, three televised debates have been held to generate more public interest in the election. But with each lasting four hours and set to a complex format devoting only short periods for questions and answers, the initiative may do the opposite.

Hassan Rohani, a moderate who was Iran's chief nuclear negotiator under reformist former president Mohammad Khatami, defended his role in foreign policy then by saying he had headed off a possible US attack. He said Iran must avoid "extremism".

"During the presidency of Mr Khatami the country was saved from a crisis ... two regional countries came under attack and Iran was always in the list," he said, alluding to Afghanistan and Iraq which border Iran to the east and west respectively.

Please LIKE our Facebook page - it makes us stronger