WASHINGTON — President Obama awarded the Medal of Honor on Thursday to a soldier who rushed a suicide bomber in Afghanistan in 2012 and saved perhaps dozens of American and Afghan lives at a devastating cost to his own.

The soldier, Capt. Florent A. Groberg, has spent much of the last three years recovering from 33 operations, but he stood at attention in the East Room of the White House as the commander in chief bestowed on him the highest commendation available to members of the American military.

“On his very worst day, he managed to summon his very best,” Mr. Obama said. “That’s the nature of courage — not being unafraid but confronting fear and danger and performing in a selfless fashion. He showed his guts, he showed his training, how he would put it all on the line for his teammates. That’s an American we can all be grateful for.”

Captain Groberg, 32, who goes by Flo and retired from the Army this year to serve as a civilian in the Defense Department, was only the 10th living recipient of the Medal of Honor from actions during the war in Afghanistan. The ceremony came the day after Veterans Day as Mr. Obama sought to demonstrate concern for those who served even as he tries to wind down the war in Afghanistan.