Kabul, Afghanistan (CNN) -- After surveying training camps in eastern Afghanistan, Defense Secretary Robert Gates hinted Wednesday that U.S. troops could be leaving earlier than the announced July 2011 troop withdrawal date.
Without giving details, Gates said that any early pullout and handover of control to Afghan forces "would have to be conditions-based."
"We will begin that transition no later than July 2011, but the pace will depend also on conditions on the ground," Gates said after watching training exercises at Camp Blackhorse, where U.S. and British forces train Afghan soldiers.
President Obama ordered the deployment of 30,000 extra U.S. forces to Afghanistan this year, increasing the total American troop commitment to almost 100,000, while at least 25 other countries have pledged another 7,000 troops.
Gen. Stanley McChrystal, the U.S. commander in Afghanistan, has said Obama's additional goal to begin withdrawing U.S. troops in July 2011 will force Afghan officials to take the lead in ensuring their country's security. The U.S. hope would be to grow the Afghan National Security Forces to their authorized size of 170,000 soldiers and 134,000 police by the pullout date.
Afghan Defense Minister Abdul Rahim Wardak, who accompanied Gates on the tour of Camp Blackhorse, said he was confident Afghan forces would stand up to the task.
"We have demonstrated that capability throughout the history," Wardak said, adding that much would depend on a strong government and the ability to provide essential services.
Gates thanked the Afghan soldiers for their service.
"We will be your steadfast brothers in arms and friends," he said, concluding a two-day unannounced visit to Afghanistan.
Iranian President Mahmoud Ahmadinejad was also in Afghanistan on Wednesday with a pledge to purge "occupying forces" from the troubled land.
"Iran has innovative plans for resolving ongoing problems in Afghanistan and the withdrawal of the occupying forces from the country," Ahmadinejad said ahead of landing in Afghanistan, Iran's state-run Press TV reported.
Gates has accused Iran of "playing a double game" by befriending Afghan President Hamid Karzai's government while secretly aiding Taliban fighters.
Gates said he told Karzai that Afghanistan ought to have good regional relations but its neighbors must play an upfront game.
Gates visited Afghanistan as NATO-led coalition forces are pressing an offensive against Taliban forces around the town of Marjah in southern Helmand province.
Dubbed Operation Moshtarak, the offensive was launched in February by an international coalition of 15,000 troops, including Afghans, Americans, Britons, Canadians, Danes and Estonians.