Ryan Jeschke, 31, who grew up in Northern Virginia, was the grandson and great grandson of Marines. After he graduated from Herndon High School in 1999, he joined the Marines, too.

Relatives said Jeschke, a gunnery sergeant, had been sent six times to Iraq and Afghanistan. “He was a hero,” an uncle said.

The Pentagon reported Monday that Jeschke was one of three Marines killed Aug. 10 in Helmand province, Afghanistan. The Pentagon said they were part of a Special Operations battalion based at Camp Pendleton in California and were conducting combat operations.

The North County Times, a California newspaper, quoted military officials in Afghanistan as saying the Marines were shot by an Afghan police officer who had just shared a meal with them. The newspaper, which serves the Camp Pendleton area, said the three were in a secretive unit that carries out some of the war’s most dangerous missions.

Jeschke was “an amazing guy,” said a second uncle, Tripp Bradd. “He was there for his team” and served to “protect his country and to help the Afghan people.”

Preparing Afghans to govern themselves and to overcome the damage of war “was a passion he had,” Bradd said.

In a book about Iraq, Sgt. Jeschke was quoted in a way that indicated how he had retained his humanity amid the carnage. Jeschke told the author about seeing a father cradling a small girl who had been killed. He wondered aloud about the father’s feelings, and another Marine remarked that Arabs grieve less than Americans. But Jeschke said: “I don’t really believe him. I can’t see how it would be any different for them.”

As a boy, Jeschke was fond of martial arts, relatives said. On graduating from high school, they said, he enlisted.

A grandfather, retired Marine Col. Richard Hall Jeschke Jr., who died 12 years ago, had taken part in the Iwo Jima campaign during World War II and also served in Korea during the war there. In addition, Jeschke’s great-grandfather had retired from the Marine Corps as a brigadier general and had also served in World War II.

Another relative, James P.S. Devereux, was also a Marine brigadier general, and he had commanded the defense of Wake Island in the early days of World War II. To Jeschke, these forebears were “an inspiration,” Bradd said

Jeschke and his wife, Sheila, had a home in California.