— An Afghan man rammed a stolen pickup truck onto a military airfield in southern Afghanistan and ran from the vehicle in flames just as a plane carrying Defense Secretary Leon E. Panetta landed Wednesday, U.S. officials said. Nobody on the plane was harmed, and Panetta went ahead with a visit marked by unprecedented tension between U.S. and Afghan authorities.

Pentagon officials said they could not immediately confirm that the bizarre incident was an attempt to attack Panetta or even that it was linked to his visit. Although many details remained unexplained, it appeared to be the most serious security breach in a visit to Afghanistan by a high-level U.S. official during the decade-long war.

Hours after the incident, officials traveling with Panetta disclosed that an Army staff sergeant who allegedly massacred 16 Afghan villagers in Kandahar province early Sunday has been moved out of Afghanistan. The late-night disclosure appeared likely to exacerbate tensions with Afghans who had demanded that the shooter be tried in an Afghan court.

In Washington, President Obama insisted that “our forces are making very real progress” in Afghanistan, and he reaffirmed a transition plan under which U.S. and NATO troops would withdraw by the end of 2014.

According to Pentagon officials, an Afghan civilian stole a pickup truck from a NATO service member, rammed through a fence and drove at high speed onto the airfield at Camp Bastion, a British installation adjoining the U.S. Marines’ Camp Leatherneck base in the southern province of Helmand. The driver, a contract interpreter on the base, crashed into a ditch near the ramp where Panetta’s plane was going to park, and then fled the vehicle in flames and jumped onto a truck before being apprehended by security guards.

Base personnel put out the fire, but the man later died of burns, said Lt. Gen. Curtis Scapparrotti, the number two American commander in Afghanistan.

Pentagon spokesman George Little said no explosives were found on the man or in the vehicle. “It is my understanding that the car itself never caught on fire and did not explode,” he said.

He said the NATO soldier was seriously injured when he was struck by the vehicle during the carjacking.

“We don’t know all the facts, but we have no indication that the secretary was ever at risk,” Little said.

“There is no evidence right now that the driver had any idea who was on that aircraft,” said Navy Capt. John Kirby, another Pentagon spokesman. “We do not have an indication it was intended as an attack.”

The incident occurred about the time of Panetta’s 11 a.m. arrival at Camp Bastion but was not disclosed by Pentagon officials until about 10 hours later, after some details of it had leaked to the British news media.

It came three days after the pre-dawn shooting rampage by a U.S. soldier — a massacre that has provoked widespread outrage across Afghanistan.

Kirby said the soldier was moved to a pretrial detention center “based on a legal recommendation,” but he declined to say where. The unidentified staff sergeant has not been charged, but U.S. officials said he surrendered after the killings and admitted his involvement. A senior U.S. official who spoke on the condition of anonymity said he was flown to Kuwait.

The soldier’s unit is from Joint Base Lewis-McChord, near Tacoma, Wash., and it is likely that he will face prosecution there if he is charged. A decision on whether to convene a court-martial would be made by an Army general in the soldier’s chain of command.

Amid continuing furor over the slayings, U.S. officials showed a base surveillance video of the staff sergeant surrendering to Afghan security guards upon his return to his combat outpost. The video, recorded from a spy balloon floating over the outpost, was released as part of an effort to knock down rumors that other U.S. troops might have been involved.

Panetta, making his third trip to Afghanistan, pledged during his visit that a recent string of setbacks would not force the United States to alter its strategy here.

Maj. Gen. Mark Gurganus, the senior Marine commander in southern Afghanistan, virtually ruled out further restrictions on night raids, which have drawn repeated criticism from Afghan President Hamid Karzai and have been a major stumbling block in talks on the framework of a long-term security relationship.

“I don’t know how much more accommodating we can be with what is a critical element of a counterinsurgency fight,” Gurganus said. All the night raids are being conducted by joint teams of U.S. and Afghan forces, he said.

Speaking to U.S. and Afghan troops at Camp Leatherneck, Panetta sought to tamp down worries about the course of the U.S. war effort after Sunday’s killings in Kandahar province, as well as the nationwide riots that followed an inadvertent burning of Korans last month by U.S. troops at a base north of Kabul.

“We have been tested time and time again over a decade of war,” Panetta told the U.S. and Afghan troops who gathered in a stuffy tent. “That is the nature of war. . . . Each of these incidents is deeply troubling, and we have to learn lessons from each of these incidents.”

In a departure from past practice, about 200 Marines at Camp Leatherneck were told to set their rifles outside before hearing Panetta speak. Gurganus said he ordered the move out of respect for the two dozen Afghan soldiers who attended the meeting without weapons. “This is not a big deal,” he said.

At the White House, Obama said in a joint news conference with visiting British Prime Minister David Cameron: “The tragic events of recent days are a reminder that this continues to be a very difficult mission.”

But he said it was “also undeniable . . . that our forces are making very real progress.”

Obama said he and Cameron “reaffirmed the transition plan” that NATO has adopted, including a shift to a support role next year ahead of a transfer to Afghans of “full responsibility for security” in 2014.

“We’re going to complete this mission, and we’re going to do it responsibly,” Obama said.

Staff writers William Branigin, Craig Whitlock and Rajiv Chandrasekaran in Washington contributed to this report.