Editor's note: Jake Tapper is an anchor and chief Washington correspondent for CNN. He is author of the best-selling book about Afghanistan, "The Outpost: An Untold Story of American Valor."
Minot, North Dakota (CNN) -- Staff Sgt. Clint Romesha was taking stock: His small outpost nestled in a remote valley of a mountain range in eastern Afghanistan was under attack by hundreds of insurgents.
Three American soldiers were dead, killed by militant snipers hidden in heavy brush on the side of the mountains.
Three were trapped in a mortar pit. Five more -- two of his close friends included -- lay pinned down in a Humvee, taking heavy fire. Others were badly wounded.
Romesha, who had a hole in his arm from a rocket-propelled grenade, was trying to figure out who was alive and who was dead.
Then a call went out on the radio: ENEMY IN THE WIRE.
The insurgents were now inside the camp.
Story of valor
The battle for Combat Outpost Keating -- considered one of the worst ground attacks during the Afghanistan war -- is a cautionary tale.
It's the story of an isolated, indefensible post, considered one of the most vulnerable in Afghanistan, where soldiers were overwhelmed by the Taliban in a bloody assault years in the making.
When the fighting was over more than 12 hours later, more than half the 53 soldiers at COP Keating were dead or wounded.
Buried in that story is the saga of the uncommon valor of Clint Romesha.
On Monday, he will become only the fourth living person to receive the Medal of Honor for actions in Afghanistan or Iraq.
But on that day, deep in a valley of the mountains of Afghanistan's Nuristan province, it wasn't about a medal.
It was about the men in his section. It was about the buddies he tried to save. It was about the comrades he lost.
In war, heroism is not the intention. But sometimes, it's the result.
There was little about COP Keating that was comforting to the commander, Capt. Stoney Portis, the platoon leader, 1st Lt. Andrew Bundermann, and the soldiers who made up the Red and Blue platoons, collectively known as Bravo Troop of the 4th Infantry Division's 4th Brigade Combat Team, 61st Cavalry Regiment.
By any standard, COP Keating was built in a tough location to defend. It sat on the valley floor, a target for anyone above it in the rugged southern Hindu Kush mountains.
"First reaction was, I think, the same as everyone. You know, this is a pretty indefensible spot," Romesha said in CNN's documentary "An American Hero: The Uncommon Valor of Clint Romesha" that first aired Thursday.
Even the name of the base reflected its harsh surroundings. It was named for Army 1st Lt. Benjamin D. Keating, who was killed when a road leading to the outpost gave way and his vehicle went off the side of a mountain.
Keating was one of a series of small outposts built in Afghanistan's remote regions. It was intended to connect civilians with international forces and the Afghan government and, of course, to fight the insurgency.
With so few helicopters in Afghanistan at the time, commanders decided when the outpost was built in 2006 that it needed to be near a road so it could be resupplied and to be near the local population.
But as the years passed, the insurgency strengthened, and relations between U.S. troops at COP Keating and the locals dissolved after a remote-controlled IED targeted a commander in 2008.
"I knew it was a bad spot, and I knew that previous commanders had expired there. But to sit there and dig up every little detail on it, it wasn't healthy for the guys to be exposed to that information," said Romesha, a section leader in Red Platoon.
There was good reason to feel that way. The base had been repeatedly targeted by insurgents with mortars and rocket-propelled grenades, including more than 40 times in the preceding five months, with sometimes deadly results.
Just hours after Bravo Troop arrived in May 2009 at the outpost, the soldiers they were replacing came under fire as they were leaving -- with one suffering a massive head wound and others suffering shrapnel wounds.
These insurgents weren't "your average run-and-gun types," Romesha said later.
He knew it wasn't a question of would they be hit, but when.
Explosions and gunfire
Romesha, Sgt. Thomas "Raz" Rasmussen and the other soldiers of Bravo Troop spent countless hours plotting what a Taliban strike at Keating would look like.
Would it come under the cover of darkness when the soldiers were asleep? Would they take out the mortar pit first? Would they target the Humvees positioned throughout the base to spot insurgents taking potshots? Would they target the ammunition depot?
The answer came just before sunrise on October 3, 2009.
It began with the sound of explosions and gunfire right outside the base.
Pfc. Chris Jones was awakened by the explosion. He grabbed his machine gun and headed out the door.
Romesha, "Ro" to his fellow soldiers, heard it too. As he put on his body armor, he listened to reports coming in over the radio.
"You could just tell this was something serious," he said.
Much of the base's defense relied on a mortar pit to target high, angled positions where the Taliban would take cover and fire, and a nearby Humvee equipped with a long-range surveillance system. Both were set up on the opposite side of the base.
There also were some 20 soldiers at an observation post on the side of a nearby mountain that looked down over the base and could provide covering fire.
That morning, the Taliban began the attack by focusing their fire on the mortar pit, the Humvee and the observation post.
In the first minutes of the battle, Pvt. Kevin Thomson was killed -- gunned down as he ran for the M240, a belt-fed, gas-operated, fully automatic machine gun.
From that moment, manning the mortars was impossible for Bravo Troop.
For years, the Taliban had been testing COP Keating's defenses, one attack at a time.
They studied the base's perimeters from various positions on the mountain, high above the base.
It was clear, almost immediately, that this was a well-coordinated attack and it had been launched by more than just a handful of insurgents.
What the soldiers didn't know was that the Taliban had hidden mortars, rockets and heavy machine guns in the mountains around the base. The soldiers couldn't see the hundreds of militants who had taken up positions around them.
Among them were Taliban snipers who picked off soldiers in the base below.
Sgt. Joshua Kirk was killed while returning fire; Spec. Michael Scusa was gunned down as he ran to deliver ammunition.
Amid the explosions and gunfire, Romesha was trying to organize and rally his soldiers.
"The shots just kept coming in and coming in and coming in," Jones said. "I could barely hear myself think. I mean everywhere around me was being hit."
It was then the radio crackled with more bad news: Five men were pinned down inside a Humvee. Among them were Romesha's close friends in the platoon: Sgts. Justin Gallegos and Brad Larson.
They were taking heavy fire. They were running out of ammunition. They were unable to hold out much longer.
As the gunfire and mortars rained down on the Humvee, Romesha spotted several areas where militants were firing from.
His plan, Romesha radioed to Gallegos, was that he and another soldier would lay down cover fire so the five could escape the Humvee.
Romesha and Spec. Justin Gregory scrambled atop a generator and opened fire, focusing on the Taliban fighters firing at the Humvee.
By doing that, Romesha made a mistake, he would later say.
The staff sergeant had always taught his troops not to fixate on a target. "Keep your head on a swivel," looking to the left and right, he told them.
As Romesha was focused on trying to help the men in the Humvee, the "enemy had snuck up on my right side and fired an RPG right at the generator I was on."
The RPG knocked Romesha onto Gregory, who was wounded by shrapnel.
They were dangerously low on ammunition. The staff sergeant picked up the last belt of ammunition and started to fire.
"Everything was a target at that point. There was movement everywhere. The muzzle flashes were everywhere. You just couldn't pick them out fast enough," Romesha said.
"I tried to hold it as long as I could, but when you're the only machine gun talking on the COP at that point, you start drawing quite a bit of attention."
Out of ammunition and under fire from all sides, Romesha failed in his mission to help Gallegos, Larson and the others.
"I called Gallegos and told him I was sorry," he said recently, pausing as he was overwhelmed by the memory.
"I just told him I was sorry. ... I just couldn't hold it anymore. Ran out of ammo and that position was compromised. I just couldn't put enough effective fire down for them."
Chaos was continuing elsewhere on the base. The roughly 20 Afghan soldiers based with Bravo Troop had fled or were hiding, leaving just the American troops to try to battle back.
Maybe it was the adrenaline. Or maybe it was total concentration on trying to save the men in the Humvee.
Whatever it was, Romesha never felt the injury caused by the RPG that had minutes earlier knocked him into Gregory.
"Dude, you have a hole in your arm," Rasmussen said as Romesha arrived back at the barracks to regroup his soldiers.
As Rasmussen bandaged the staff sergeant's arm, something much more serious, much more dangerous was playing out: Taliban militants had breached the base.
The message went out on the radio: ENEMY IN THE WIRE.
Inside the barracks, Romesha was assessing who was still alive, who of the wounded could fight and how much ammunition was left.
Sgt. Joshua Hardt approached Romesha with an idea: He would take two soldiers, grab a Humvee outfitted with a .50-caliber machine gun and make a run to try to save the five men pinned down.
Romesha knew it would be a hard fight for Hardt. He talked to him about finding a good position for the truck to fire from.
Hardt and the soldiers ran for the truck. Once inside, he radioed Gallegos to let him know of their plan as Romesha listened.
"This isn't a good spot. You can't do a lot. Stay away. Stay away," Gallegos told Hardt.
But the sergeant pressed on ... until an RPG exploded near the Humvee.
Now the Humvee was stuck, and the militants were targeting them with more grenades.
Hardt ordered Pvt. Chris Griffin and Pvt. Ed Faulker Jr. to make a run for it.
Griffin got out and was killed immediately. An RPG hit the Humvee, spraying Faulkner's left side with shrapnel.
Hardt and Faulkner knew they had to get out of the Humvee. Faulkner got out first, and Hardt was to follow.
Faulkner ran for the aid station.
Then Romesha heard Hardt on the radio: "I have an RPG pointed right at me."
That was the last time he heard his voice.
Romesha needed to know how many of Bravo Troop's soldiers were dead or wounded.
He grabbed a Russian-made rifle left by an Afghan soldier and walked outside.
There, Romesha saw three Taliban militants walk by the base's entrance "like they thought they'd already won."
"It threw me for a second. It was one of those 'are you serious' moments," he said.
Romesha watched as less than 100 yards away the militants took up position by one of the Humvees.
He leveled the rifle at the three militants, focusing on the one in the middle.
"This is a give me. This is a freebie," he told himself just before he pulled the trigger and "dropped the guy in the middle."
The situation was dire: At least five Americans had been killed, the soldiers in the mortar pit were cut off, militants had breached the base and nobody had heard from Gallegos, Larson or the others trapped in the Humvee.
"We couldn't just sit there and take it. It was time to be aggressive," Romesha said.
By any standard, it was an audacious plan.
Outnumbered, outgunned, Romesha and the lieutenant devised a plan with Sgt. 1st Class Jonathon Hill from Blue Platoon.
The soldiers were getting air support now, Apache gunships and a bomber.
The plan called for Romesha to run up the north side of the outpost with a small team, first securing the ammunition supply depot.
Meanwhile, another sergeant would push a separate group of U.S. troops to the south side of the base.
Romesha's team would then regain control of the entrance gate, save the men stuck in the Humvee and get to the mortar pit.
"It seemed pretty simple to me at the time," he said.
"You know it was time to find our guys. We had the tools. We had the training. We had the spirit. We had the support of each other. It was the time."
To succeed, Romesha needed his soldiers to follow him. He asked for volunteers.
"I said 'we'll take this bitch back,'" he said.
Rasmussen, Jones and two others volunteered without hesitation.
"There were few people I would follow to hell and back, and Romesha is one of them," Jones said.
The soldiers made a daring dash across the base, firing in every direction.
It was during this time one of the soldiers with Romesha was shot in the shoulder. Over the radio, the lieutenant told Romesha to hold his position.
But the staff sergeant felt there was no time to lose. He ignored the call, pretending his radio was broken.
They got to the ammunition supply depot. The soldiers had no idea if the militants who had gotten inside the base had also gotten inside the depot, so they stormed the building.
Romesha and another soldier swept inside with machine guns after Rasmussen fired a grenade.
There were no militants. But the discarded AK-47s in the room were a sign they had been there.
Romesha and his soldiers were back in the fight, and now they were in control of a building that gave them a better view of where the Taliban militants were located.
The soldiers began calling in airstrikes.
It had been hours since Romesha heard from any of the soldiers in the trapped Humvee.
The last radio transmission anyone remembered hearing was Gallegos warning Hardt off an attempted rescue.
But suddenly, there was news on the radio: Larson and two others were alive, but Gallegos was dead.
He had been gunned down when he and two others -- Staff Sgt. Vernon Martin and Spec. Stephan Mace -- got out of the Humvee as part of an escape plan they hatched.
Martin was missing; Mace was badly wounded but back in the Humvee.
Then Romesha and his soldiers came up with another plan: Go outside and lay down heavy fire from the machine guns as an airstrike targeted a village nearby that militants were using as a staging area, giving the three soldiers -- Larson, Mace and Sgt. Ty Carter -- a chance to escape the Humvee.
The plan worked.
Next, Romesha and his soldiers ran to a small mud hut near the front gate. A short time later, Larson waked through the door with vital supplies -- warm Dr Pepper.
"I remember just giving him a hug. I'd known Larson since he came in the service and, I mean we had been together forever," he said.
The soldiers sat for a moment, drinking the soft drink, a platoon staple.
"Warmest Dr Pepper you could ever imagine. But man it was good," Romesha said.
The battle for COP Keating had been raging for hours. By now, most of the outpost was on fire or destroyed.
Until they could make it to the mortar pit in the corner of the camp, there was just one more thing for the soldiers to do: recover the dead soldiers.
Romesha was worried the militants would make off with the bodies. He wanted the families of the fallen to have closure. He wanted them to be able to be with their sons just one more time.
Militants were still firing into the base when the staff sergeant and his soldiers went out on to the base to retrieve the bodies of Gallegos and Martin, who was found with two gunshot wounds at close range to the back of his head.
They found the body of Griffin, who was killed in the rescue attempt.
Hours later, the soldiers found Hardt's body strewn amid the corpses of Taliban militants. He, too, had been shot in the head at close range.
Other soldiers, meanwhile, got to those trapped in the mortar pit.
Planes and helicopters filled the valley by late afternoon, and a quick reaction force was on the way.
It wasn't enough for Mace. He died from his wounds. He was number eight.
That night, the soldiers hunkered down on the base. Half the soldiers slept at the aid station, while Romesha and his men bunked down in the barracks.
Jones pulled out his guitar and started to strum Johnny Cash's "Folsom Prison Blues."
It was still dark in the north central North Dakota city of Minot in late January, when 31-year-old Romesha climbed into his car for the 90-minute commute to his job as a field safety specialist for an oil field construction firm.
He had left the Army in 2011.
It was time. He had spent years away from his wife and three children. He had missed so many moments.
The radio kept him companion on this long daily drive. Sports scores, conservative talk radio and occasionally some country music. Every now and then, a Johnny Cash song would bring him back.
For a few minutes, he was back in Afghanistan listening to Jones make up "quirky, little songs" that he and Scusa would sing to the unit.
Romesha doesn't concentrate on the bad stuff -- the death, the destruction.
"I still reflect on my time in Afghanistan. But when I'm doing that, I'm thinking about the quirky little songs that Jones used to play. I'm thinking of that Mountain Dew or that Dr Pepper. ... That was our drink forever," he said.
"I'm thinking of the days in the gym. I'm thinking of the constant teasing going back and forth."
He's thinking, he says, about the men he served with.
But it is clear the memories -- the fight, the losses -- remain with him.
It remains with all those who survived that October day.
Many have been waging battles with post-traumatic stress disorder, including Faulkner who turned to drugs to try to forget and later died from an overdose.
To many of the men of Bravo Troop, Faulkner was the ninth victim of the battle for COP Keating.
The U.S. military closed the outpost on October 6, 2009, virtually destroying what remained so it could not offer comfort or haven to insurgents.
A few months later, a U.S. military investigation found measures that were taken to protect the outpost were lax, and that critical intelligence and reconnaissance assistance had been diverted from the base.
Medal of Honor
Word about the Medal of Honor came in January in the form of a call to Romesha's cell phone.
It was from a blocked number.
He was working with a pipeline crew in North Dakota when he answered, and a secretary on the other end of the line asked if she was speaking with Clint Romesha.
"Then she told me that President Obama would like to talk to you," he said.
For a moment, Romesha was speechless.
The president offered his congratulations, and told him his actions honored the country.
"I just remember telling him that for me, it's not about me. You know, it was everyone that day up at COP Keating," he said. "So many other guys that made this day happen."
CNN's Jake Tapper reported from Minot, North Dakota; CNN's Chelsea J. Carter wrote from Atlanta.