WASHINGTON — Bleeding from both legs and his arm, Ryan Pitts kept firing at about 200 Taliban fighters, even holding onto his grenades an extra moment to ensure the enemy couldn’t heave them back. On Monday, President Barack Obama draped the Medal of Honor around his neck, in a somber White House ceremony that also paid tribute to his nine platoon comrades who died that summer day in Afghanistan.

Pitts, a 28-year-old former Army staff sergeant from Nashua, New Hampshire, is the ninth living veteran of America’s wars in Afghanistan and Iraq to receive the nation’s highest decoration for battlefield valor.

Pitts’ mission that day in June 2008 was supposed to be his last before returning home from his second tour of Afghanistan.

The goal was to move troops and equipment out of Combat Outpost Bella, a remote post roughly 10 miles from the nearest base, to a new site nearby. Accessible only by helicopter for supplies and reinforcements, Outpost Bella was slated to be closed.

At 4 a.m., Pitts was manning his observation post. On the horizon, he could see the blue-roofed buildings and protective stone walls of the town of Wanat: A one-story mosque, a hotel and cafe, some homes and a local bazaar.

What Pitts couldn’t know was that all of those buildings were concealing enemy fighters. Some 200 of them soon launched a full-scale assault on the outpost, their machine-gun fire puncturing the early morning silence.

A cascade of rocket-fired grenades, gunfire and hand grenades hit the troops, quickly killing two paratroopers. Shrapnel from grenades struck Pitts in both legs and his left arm. Unable to walk, he crawled to a comrade, who put a tourniquet on his leg.

For more than an hour, Pitts fought to protect the remaining troops and defend the post, the Army said. Propping himself up on his knees, he blindly fired a machine gun over a wall of sandbags. He reloaded and kept firing his weapon.

He radioed back that he was alone, his teammates having all relocated or been killed. Enemy forces were so close to Pitts that those listening on the other end of the radio could hear them.

That’s when Pitts accepted he was going to die, Obama said. But he decided to keep fighting anyway.

“That little post was on the verge of falling, giving the enemy a perch to devastate the base below,” Obama said. “Against that onslaught, one American held the line.”

More than an hour after the attack started, Pitts was evacuated, and eventually made a full recovery. The Army said but for his determination to fight while wounded, the enemy would have gained ground and killed more American troops.