They are pouring across the border into Iran by the thousands. Bedouins and nomads on livestock are fleeing an increasingly isolated and bisected Afghanistan ahead of an imminent U.S.-led military strike.

But even as Iran opens its doors to the beleaguered people of Afghanistan and condemns the hard-line Taliban government for harboring terrorists, the anti-U.S. rhetoric continues — even if it is more subdued than usual.

Monday, Iran's Defense Minister said the country would react "strongly" if the United States used Iranian airspace for an attack on neighboring Afghanistan. The country’s supreme leader, Ayatollah Ali Khamenei, has said Iran does not consider the United States "competent and sincere [enough] to lead any global campaign against terrorism."

The conflicting signals coming from Tehran in recent week underscore an internal political tug-of-war plaguing a country that could be key in America’s efforts to build a sustainable coalition against terrorists hiding in the Middle East and Southwest Asia.

Mark N. Katz, professor of government and politics at George Mason University and an expert on the Mideast, said the United States should be making every effort to bring Iran into the fold.

"First, Iran is an Islamic republic, and as such it can play a central role in this," Katz said. "They are a democratizing nation, if not a democratic nation; and if we can get their cooperation in this conflict, essentially having them line up with the U.S. facing a common enemy in the Taliban, this would give the American effort a lot of credibility in the Muslim world."

But the effort won't be easy. Iran reformists, who came to power via the vote and favor the democratic rule of law, are struggling with conservative mullahs who take a more hardline, religiously strict approach to public life.

The struggle has already caused contradictions in Iran’s stance since the Sept. 11 terrorist attacks in New York and Washington, D.C.

Initially Iran strongly condemned the attacks, even temporarily suspending the "Death to America" slogans that have been a part of the regular evening prayers at Tehran University for the last 22 years.

Young Iranians, 70 percent of whom have known nothing but hardline government, mourned the victims at various candlelight vigils.

Washington welcomed the gestures of good faith by sending a public communiqué of appreciation to Iran — an unheard of nod of goodwill in a relationship more often characterized by back channel diplomacy and distrust.

"Certainly there is chance for a new relationship," said Pirouz Mojtahed-Zadeh, a senior researcher of geopolitics at the University of London. "The question before us: How deeply did the attacks change old ways of thinking?"

But the temperance quickly faded. Khamenei shortly afterward called President George W. Bush arrogant, and accused the U.S. of using the current crisis as an excuse to wage war on Islam.

Lee Hamilton, a former member of the house foreign relations committee who currently heads the Woodrow Wilson International Center, said such back and forth illustrates the tug-of-war happening in Iran between the old mindset and the new.

"I think Iran is having a very hard time figuring out where they want to stand in all of this," Hamilton said. "What you have to understand is that the Iranians hate the Taliban, but they are uncomfortable with a U.S.-led attack on a Muslim country and they seem now to be hardening their position."

Reformist leaders, led by President Mohammad Khatami, have been courting the West in an effort to get returned to them assets frozen as a result of the 1979 revolution. They also want the United States to lift a 5-year-old ban on major investment by American energy firms in Iran.

But it's not certain whether any of this will be possible with an internal political system as volatile and unpredictable as Iran's.

"The reformists see this as an opportunity to patch things up with the U.S.," Katz said. "But the conservatives aren't too keen on that. What the conservatives have going for them, is the hostility toward the U.S. It is the American threat that justifies their authoritarian rule. If that goes away then what is the need for them to be in power?"

Even though harsh rhetoric about "confronting" U.S. warplanes complicates the matter, some say any hint of rapprochement with Iran is worth the effort.

"It seems Iran is offering some wiggle room," said Ted Carpenter, vice president of the Cato Institute in Washington. "This could be an important first step in opening some discussions."

And Hamilton agrees. "I don’t think we should rule Iran out just yet. It is quite possible that somewhere down the line they can end up being very helpful to us."