Maureen and Philip Miller receive the Medal of Honor on Wednesday on behalf of their late son from President Barack Obama during a ceremony in the East Room of the White House. Staff Sgt. Robert J. Miller was killed in Afghanistan on Jan. 25, 2008.

WASHINGTON — In a ceremony that mixed pain, pride and determination, President Barack Obama on Wednesday awarded the Medal of Honor to a young Army Green Beret who saved his patrol by holding off a Taliban ambush in a snowy Afghan valley three winters ago.

He told the parents of Army Staff Sgt. Robert J. Miller, “You gave your oldest son to America, and America is forever in your debt.”

Miller was killed in the ambush.

The presentation in a hushed East Room came on the eve of the war’s ninth anniversary — and 13 months after Obama gave the same award for gallantry to another set of parents whose son was cut down on another Afghan battlefield.

Miller, 24, was a Pashto-speaking Special Forces weapons expert who led a joint U.S.-Afghan patrol — and allied aircraft — in attacking a suspected Taliban compound in northwest Afghanistan’s Kunar province, near the Pakistani border.

In predawn darkness on Jan. 25, 2008, his patrol was moving in to survey the damage when a much larger Taliban force opened fire. After ordering his comrades to fall back, Miller rushed forward, firing his weapon and hurling grenades in a bid to draw off the enemy attack.

“The fighting was ferocious,” Obama said, recounting the recollection of comrades who survived. “Rob seemed to disappear into clouds of dust and debris, but his team could hear him on the radio, still calling out the enemy’s position. . . . And then, over the radio, they heard his voice. He had been hit.”

Accepting the award from Obama were Miller’s parents, Philip and Maureen Miller, while all seven of his brothers and sisters — and 12 members of his patrol — looked on. Obama noted Miller’s brother Tom is currently undergoing Green Beret training.

“The courage he displayed that day reflects every virtue that defined (his) life,” Obama said.

Miller, a native of Harrisburg, Pa., was the third U.S. service member from the Afghan conflict to receive the Medal of Honor, the nation’s highest medal for gallantry. Soon, Obama will award the medal to a fourth, and the first living recipient: Army Staff Sgt. Salvatore Giunta, being honored for bravery during a Taliban ambush in 2007.

Speaking to reporters afterward, Maureen Miller said her son “loved what he was doing, he was good at what he was doing and he believed he was working for a good cause.”

More than 1,200 U.S. troops have perished in the Afghan conflict, now America’s longest war since Vietnam, and this year is already the deadliest yet.