In Washington, Capt. John Kirby, the Pentagon spokesman, said the truck had been stolen from a coalition service member — he did not give a nationality — who was wounded in what was apparently a carjacking. There was no immediate evidence that the Afghan driver “had any idea who was on that aircraft,” Captain Kirby said.

Mr. Panetta flew from Washington to Manas, Kyrgyzstan, on his usual plane, a reconfigured Boeing 747 with “United States of America” emblazoned on the side, but as usual for security reasons, he transferred to a gray C-17 military cargo plane for the unannounced trip to Afghanistan.

In a sign of the nervousness surrounding the trip, a sergeant major abruptly told the Marines gathered to hear Mr. Panetta in a tent at Camp Leatherneck to get up, place their M-16 and M-4 automatic rifles and 9-millimeter pistols outside, and return unarmed. The sergeant major, Brandon Hall, told reporters that he was acting on orders.

“All I know is I was told to get the weapons out,” he said. Asked why, he replied: “Somebody got itchy — that’s all I’ve got to say. Somebody got itchy. We just adjust.”

Normally, American forces in Afghanistan keep their weapons when the defense secretary visits and speaks to them. The Afghans in the tent had not been armed to begin with, as is typical.

Later, American officials said that the top military official in Helmand, Maj. Gen. Mark Gurganus, had decided on Tuesday that no one would be armed while Mr. Panetta spoke, but that word had not reached those in charge in the tent until shortly before Mr. Panetta was due to arrive.

General Gurganus told reporters later that he had wanted a consistent policy for everyone in the tent, and that “I wanted to have the Marines look just like their Afghan partners,” noting, “You’ve got one of the most important people in the world in the room.” He insisted that his decision had had nothing to do with the massacre; later, defense officials said the decision had had nothing to do with the truck at the airfield.