Iran has dug mass graves in which to bury US troops if America attacks the country, a former commander of the elite Revolutionary Guard has said.

The digging of the graves appears to be a show of bravado after the chairman of the US joint chiefs of staff, Admiral Mike Mullen, said last week that the US military had a contingency plan to attack Iran, although he thought a military strike was probably a bad idea.

The US and some of its allies accuse Iran of using its civilian nuclear programme as a cover to build nuclear weapons. Iran says its nuclear programme is geared merely toward generating electricity.

General Hossein Kan'ani Moghadam, who was the Revolutionary Guard's deputy commander during the 1980s, said graves had been dug in the south-western Khuzestan province, where Iran buried Iraqi soldiers killed during the 1980-88 war with Saddam Hussein's regime.

"The mass graves that used to be for burying Saddam's soldiers have now been prepared again for US soldiers, and this is the reason for digging this big number of graves," Moghadam said. He did not say how many were being prepared.

Recently obtained footage shows a large number of empty, freshly dug graves in a desert region of Khuzestan. The digging of the graves was first reported earlier this week by Iran's semi-official news agency, Fars.

Moghadam repeated warnings that Iran would retaliate against US bases if it was attacked. The US navy's 5th Fleet headquarters is based just across the Gulf in Bahrain.

"Iran will have no choice but to strike the American bases in the region," he said. "The heavy costs of such a war will not be just on the Islamic Republic of Iran. America and other countries should accept that this would be the start of an extensive war in the region."

The UN security council imposed a fourth round of sanctions in June in response to Iran's refusal to halt uranium enrichment, a technology that can be used to produce nuclear fuel or material for an atomic bomb.

The US and Israel have said military force could be used if diplomacy fails to stop what they suspect is an Iranian nuclear weapons programme.