In a rare move, the top Marine on Monday forced two generals into retirement after concluding they should be held to account for failing to secure a base in Afghanistan against a Taliban attack that killed two Marines.

Gen. James Amos, the commandant of the Marine Corps, said in announcing his decision that Maj. Gen. Charles M. Gurganus and Maj. Gen. Gregg A. Sturdevant “did not take adequate force protection measures” at Camp Bastion, a sprawling airfield in southwestern Afghanistan that was the Taliban target.

The Sept. 14, 2012, attack by 15 Taliban fighters caught the Marines by surprise and resulted in the deaths of Lt. Col. Christopher K. Raible, 40, and Sgt. Bradley W. Atwell, 27. The Taliban also destroyed six Marine Harrier fighter jets valued at $200 million and badly damaged others. It was one of the most stunning and damaging attacks of the war.

Gurganus, who was the top American commander in that region of Afghanistan at the time, did not order a formal investigation after the attack. In June, Amos asked U.S. Central Command to investigate, and he said he decided to take action against the two generals after reviewing the results of that investigation.

“While I am mindful of the degree of difficulty the Marines in Afghanistan faced in accomplishing a demanding combat mission with a rapidly declining force, my duty requires me to remain true to the timeless axioms relating to command responsibility and accountability,” Amos said.

Amos added that Gurganus bore “final accountability” for the lives and equipment under his command, and had made “an error in judgment” in underestimating the risk posed by the Taliban in the Bastion area of Helmand province, which included his own headquarters at a base known as Camp Leatherneck.

Sturdevant was in charge of Marine aviation in that region of Afghanistan. Amos said Sturdevant “did not adequately assess the force protection situation” at Bastion.

Amos asked the two generals to retire, and they agreed.

Gurganus, who had referred to the Taliban’s penetration of Camp Bastion’s supposedly secure perimeter as a “lucky break,” had been nominated for promotion to three-star rank; that nomination had been put on hold during the investigation. He will retire as a two-star.

A few weeks after the Taliban attack, Gurganus told a news conference that “there’s no mystery” to how the Taliban managed to get onto the supposedly secure base and launch their deadly attack using rocket-propelled grenades.

Gurganus said they used simple wire cutters to penetrate the perimeter fence, which was not equipped with alarms. “We have sophisticated surveillance equipment, but it can’t see everywhere, all the time,” he said. “This was a well-planned attack. I make no excuses for it. This was well-planned and it was well-executed.”

In fact, at least one of the guard towers near the Taliban fighters’ entry point was unoccupied at the time, officials have said.

On Monday, after Amos’s announcement, Gurganus issued a brief statement saying he felt privileged to have served in the Marine Corps for 37 years. “I will treasure that forever. I have complete trust and confidence in the leadership of our Corps and fully respect the decision of our Commandant.”

A request for comment from Sturdevant was not immediately answered.