Updated

KABUL -- U.S. Defense Secretary Robert Gates arrived in Afghanistan early Monday as coalition forces continue to restore order in the town of Marjah, the first major test of the U.S. and NATO counterinsurgency strategy since President Barack Obama ordered 30,000 new American troops to blunt the Taliban's momentum.

Gates said the offensive that began last month is encouraging, but he stopped short of saying the success in Marjah suggests that the war is at a turning point. The Marjah campaign routed most Taliban fighters from a town they once controlled, without a high casualty toll for U.S. troops and the Afghan security forces fighting alongside them.

Despite what he called positive signs, Gates cautioned against optimism.

"People still need to understand there is some very hard fighting, very hard days ahead," Gates told reporters traveling with him for the unannounced visit.

During his visit, Gates is meeting with his top military commanders and senior Afghan officials.

More On This...

    "The early signs are encouraging but I worry that people will get too impatient and think things are better than they actually are," Gates said.

    Gen. Stanley McChrystal, the top U.S. general in Afghanistan, told reporters the campaign around Marjah could have been faster, but the cost in civilian casualties would have been unacceptable.

    The campaign, he said, could been over in one night. Instead active military operations to rout the Taliban took about three weeks.

    The military counts 19 Afghan civilian deaths from errant combat action during the Marjah campaign.

    McChrystal said that would been a lot higher without the deliberately slow pace, and without significant local backing for the operation.

    The Afghan war is now in its ninth year and unpopular with a majority of Americans. The challenge for the Obama administration is to demonstrate clear progress against the entrenched Taliban insurgency this year, when the number of U.S. forces in the country will reach roughly 100,000 -- nearly triple the size of the force when Obama took office.

    Afghan President Hamid Karzai has invited Taliban participation in a spring peace conference, but U.S. officials have suggested that it is too soon to hold such a session.

    The United States supports reconciliation efforts with the Taliban under certain conditions, but Gates and others have said that effort is only likely to succeed when the Taliban have been battered militarily and see that they are losing support from ordinary Afghans.

    "My guess is they are not at that point yet," Gates said.

    Meanwhile, Iran is "playing a double game" in Afghanistan, trying to woo the Afghan government and undermining U.S. and NATO efforts by helping the Taliban, Gates said. Iranian President Mahmoud Ahmadinejad was also visiting Afghanistan this week.

    Gates had an unusually provocative warning for Tehran should it carry efforts to help the Taliban too far.

    "They also understand that our reaction, should they get too aggressive in this, is not one they would want to think about."

    Pentagon press secretary Geoff Morrell later said Gates was referring only to actions the United States might take inside Afghanistan and not to a wider confrontation with Iran.

    The Marjah offensive is the largest combined operation since the 2001 U.S.-led invasion to topple the Taliban regime. The offensive in the southern Afghan town of 80,000 is also a precursor to a larger operation planned for later this year in Kandahar, the largest city in the south and the former Taliban headquarters.

    The task following the three-week military campaign is to convince Marjah residents that the civilian government can provide them with a better life than the Taliban. But during a visit there Sunday, Karzai heard complaints from them about corruption among former Afghan government officials, looting and international forces detaining innocent civilians.

    The man appointed as the new civilian chief in Marjah has also come under scrutiny. Abdul Zahir has a violent criminal record in Germany.

    Zahir has said the allegations of a criminal record were "all a lie" and western officials say they are not pushing to oust him.

    Gates said he knows little about the allegations and would ask U.S. and Afghan officials for their views.

    "The question is if the guy committed a crime and served the time, then does that automatically rule him out? I just don't know the answer to that question," Gates said.