Republican presidential nominee Donald Trump blamed President Barack Obama for the prison sentence handed down by Iranian authorities against two dual US-Iranian citizens earlier this week who were accused of espionage.

Iran on Tuesday sentenced a dual Iranian-American national and his 80-year-old father to 10 years in prison for allegedly spying for the United States, the Islamic republic's state media reported.

Siamak Namazi, a businessman in his mid-40s with dual US-Iranian citizenship, was detained by Iran's Islamic Revolutionary Guard Corps in October 2015 during a visit to relatives in the capital of Tehran.

Scroll down for video

Iranian-American Baquer Namazi (left) and his son, Siamak Namazi (right), were sentenced to 10 years in prison on Tuesday for allegedly spying and cooperating with the US government

This past February, the IRGC arrested his father, Baquer Namazi, a former Iranian provincial governor and former UNICEF official who also has dual citizenship.

Both men were sentenced to 10 years in prison for spying and cooperating with the US government, said Tehran prosecutor Abbas Jafari Dolatabadi, according to the Fars news website, without specifying when exactly the sentences had been handed down.

'Well, Iran has done it again,' Trump tweeted on Sunday. 'Taken two of our people and asking for a fortune for their release.'

'This doesn't happen if I'm president!'

The US State Department's deputy spokesman, Mark Toner, said on Tuesday that the father and son had been 'unjustly detained' in Iran, and called for their immediate release.

The sentences were the latest against dual nationals directed by hardliners who are powerful in Iran's judiciary and security forces, in the aftermath of Iran's historic nuclear deal with the United States and other world powers last year.

Donald Trump (seen left during the debate in Las Vegas on Wednesday) has been a frequent critic of Obama's policy towards Iran (whose president, Hassan Rouhani, is pictured right)

'This doesn't happen if I'm president,' Trump tweeted on Sunday in reaction to Iran's sentencing of two dual US-Iranian citizens to prison for alleged espionage

Trump has been a frequent critic of the Obama administration's policies toward Iran.

He accused the administration of paying a 'ransom' to the Iranian government in exchange for the release of four US citizens in January.

Trump also vowed that if elected president, he would order the military to 'shoot out of the water' any Iranian vessels that threaten US ships in the Persian Gulf, Politico reported.

The Republican candidate was reacting to reports that Iranian ships were harassing American sailors in international waters.

Washington and Tehran have not had formal diplomatic relations since the 1979 revolution where the United States-backed Pahlavi dynasty under Mohammad Reza Shah Pahlavi was overthrown.

The US State Department's deputy spokesman, Mark Toner, said the father and son (pictured in this undated photo) had been 'unjustly detained,' and called for their immediate release

Earlier this year, the Obama administration lifted most of its sanctions against Iran after a UN watchdog reported that Tehran had complied with a nuclear weapons deal.

Iran has been under strict international sanctions since October 2007, although the Untied States has had some form of economic restrictions on Tehran since 1979.

However, a report by the International Atomic Energy Agency said Tehran had fulfilled its commitments under a nuclear deal to prevent weapons development.

Trump told The Washington Post that the nuclear deal agreed to by the administration and Iran was 'disastrous.'

If he is elected president, Trump has vowed to 'renegotiate' the agreement.

Meanwhile on Sunday, Iranian President Hassan Rouhani told some of his countrymen that the behavior by Trump and his Democratic opponent, Hillary Clinton, during the presidential debates is more proof as to why Iran should shun American-style democracy.

'Did you see the debate and the way of their speaking, accusing and mocking each other?' Rouhani told a crowd in the central Iranian city of Arak. 'Do we want such a democracy and election in our country?'

'You see the United States that claims it has had democracy for more than 200 years. Look at the country, what the situation is where morality has no place.'

Rouhani's statements were reported by ITV News.

The comments were also broadcast in Iran by state media.

When asked which candidate he would prefer to be elected, Rouhani made it clear he is not enamored by either of them.