Iran's top nuclear negotiator says Iran will retaliate and accelerate its efforts to develop nuclear technology if attacked by the US or Israel.
The US believes Iran is years away from developing nuclear arms
Hassan Rohani told Reuters news agency there was nothing the West could do that would persuade Tehran to scrap its nuclear programme.
Both the US and Israel have said it would be unacceptable for Iran to have nuclear weapons.
Iran says its nuclear programme will be used to generate electricity.
The US has refused to rule out a military strike on Iran, but has said it will try to resolve the dispute by diplomatic means.
Mr Rohani, secretary-general of Iran's Supreme National Security Council, said Iran's ability to produce nuclear parts had made it "invulnerable" to attack since it could simply rebuild whatever was destroyed.
"If such an attack takes place then of course we will retaliate and we will definitely accelerate our activities to complete our fuel cycle and make nuclear fuel," he said.
"But I do not think the United States itself will take such a risk," he added. "They know our capabilities for retaliating against such attacks."
Mr Rohani said that not even the offer of lifting US sanctions or security guarantees from Washington would be enough to make Iran abandon its enrichment programme.
"Uranium enrichment is Iran's right," he said.
On Sunday, US Defence Secretary Donald Rumsfeld said intelligence estimates indicated Iran was some years away from developing nuclear arms.
Iran has agreed to suspend all its enrichment activities during negotiations with Britain, France and Germany.
The US is not taking part in negotiations, and wants Iran to be referred to the UN Security Council, which has the power to impose sanctions.
The European countries would like to use a package of incentives to induce Iran to give up its nuclear ambitions, but Tehran has said it is disappointed with what is on offer so far.
It says it can only continue talks for a matter of months, not years.
Enriched uranium can be used to produce nuclear power, but the technology behind it can also be used to develop weapons-grade nuclear material.