Washington (CNN) -- A Marine who defied orders and braved a blizzard of enemy fire to recover wounded and dead fellow American and Afghan troops during a six-hour firefight in Afghanistan received the Medal of Honor Thursday from President Barack Obama.

"I know that you've grappled with the grief of that day, that you have said that your efforts were somehow a failure because your teammates didn't come home," Obama told Dakota Meyer, who became the first living Marine to be recognized with the nation's highest military honor for actions in Afghanistan or Iraq.

"But, as your commander-in-chief, I want you to know it's quite the opposite. You did your duty above and beyond, and you kept the faith with the highest traditions of the Marine Corps that you love."

"The award honors the men who gave their lives that day, and the men who were in that fight," Meyer said, according to a Marine newsletter. "I didn't do anything more than any other Marine would. I was put in an extraordinary circumstance, and I just did my job."

The incident began before dawn on September 8, 2009, as a patrol made up of Afghan forces and their American trainers were making their way on foot up a narrow valley in Kunar province to meet with elders in a village. Meyer was about a mile away when Taliban fighters ambushed the patrol, firing from three sides, Obama said.

Meyer and Staff Sgt. Juan Rodriguez-Chavez could hear the ambush over the radio as the Taliban fighters unleashed a firestorm from nearby hills, Obama said.

Soon a number of men were killed and several Afghans and Americans were pinned down, including four members of Meyer's team, Obama said.

"Four times, Dakota and Juan asked permission to go in; four times they were denied," Obama said. "It was, they were told, too dangerous."

But Meyer and Rodriguez-Chavez left their relatively safe location and jumped into a Humvee, with Meyer manning a gun in the turret, his body and head fully exposed to a rain of fire from AK-47s, machine guns, mortars and rocket-propelled grenades, Obama said.

As they reached wounded Afghan soldiers, Meyer jumped out and loaded them into the Humvee, then drove them back to safety, Obama said.

"Those who were there called it the most intense combat they had ever seen," the president said.

For a second time, the men drove back into the hail of fire to pick up more wounded Afghans; when one gun jammed, Meyer and Rodriguez-Chavez switched to another vehicle, Obama said.

On their third trip, they found a group of wounded Americans "desperately trying to escape the bullets," Obama said. "Juan wedged the Humvee right into the line of fire, using the vehicle as a shield. With Dakota on the guns, they helped those Americans back to safety as well.

"Dakota later confessed, 'I didn't think I was going to die; I knew I was,'" Obama said. "Still, they pushed on."

They made a fourth trip, and then a fifth. On the fifth trip -- now accompanied by others -- they reached the bodies of the four members of Meyer's team. "Dakota jumped out and ran toward them, drawing all those enemy guns on himself, bullets kicking up the dirt all around him," Obama said.

"Dakota and the others who had joined him knelt down, picked up their comrades and, through all those bullets, all the smoke and all the chaos, carried them out, one by one."

Meyer agreed to accept the medal in their names: 1st Lt. Michael Johnson, Staff Sgt. Aaron Kenefick, Petty Officer Third Class James Layton and Gunnery Sgt. Edwin Johnson.

"I was a failure," Meyer told CNN last fall. "My guys died. That was my whole team."

Neither Obama nor the Marines saw it that way. A defense official with knowledge of the award process last fall said that just before he retired, the U.S. Marine commandant, Gen. James Conway, recommended Meyer for the nation's highest award for bravery.

The actions of Meyer, 23, saved the lives of 13 U.S. Marines and soldiers and 23 Afghan soldiers, according to the Marines' Medal of Honor account. He also is credited with killing at least eight Taliban insurgents during the incident.

For his role in the battle, Staff Sgt. Juan Rodriguez-Chavez received the Navy Cross, the second-highest decoration that may be bestowed on Marines.

Meyer, who serves in the Inactive Ready Reserve of the U.S. Marine Corps Reserve as a sergeant in his home state of Kentucky, said in November that he didn't want to discuss details of the incident because it was still difficult to think about.

On Wednesday, Obama and Meyer had a beer together on the patio outside the Oval Office. According to a series of tweets by White House spokesman Jay Carney, when a member of Obama's staff called Meyer over the weekend to prepare, "Meyer made a special request. ... Meyer asked the staffer if he could have a beer with the president."

Meyer is only the second Marine to earn the Medal of Honor from the current wars. In April 2004, Marine Cpl. Jason Dunham was leading a patrol in an Iraqi town near the Syrian border when a person in a vehicle dropped a grenade. Dunham hurled himself on top it, using his helmet to try to blunt the force of the blast. He died eight days later and received the honor posthumously.

CNN's Larry Shaughnessy contributed to this report