It is a graphic image of the harsh realities of war: the fatally wounded young marine lying crumpled in the mud, his vulnerable face turned to the camera. And it is one the US defence secretary would rather you did not see.

Lance Corporal Joshua Bernard, pictured being tended by comrades in southern Afghanistan, died of his injuries soon after. Now the release of this record of the 21-year-old's last moments has divided America, prompting furious debate over the sanitisation of war at a critical time for the military offensive.

The US defence secretary, Robert Gates, condemned the decision by the news agency Associated Press to publish. "I cannot imagine the pain and suffering Lance Corporal Bernard's death has caused his family. Why your organisation would purposefully defy the family's wishes, knowing full well that it will lead to yet more anguish, is beyond me.

"Your lack of compassion and common sense in choosing to put this image of their maimed and stricken child on the front page of multiple American newspapers is appalling."

However, AP, whose photographer Julie Jacobson took the shot after being caught in the middle of an ambush while accompanying marines on patrol, said it had acted only after a "period of reflection" and argued that the picture illustrated the sacrifice and the bravery of those fighting in Afghanistan. "We feel it is our journalistic duty to show the reality of the war there, however unpleasant and brutal that sometimes is," said Santiago Lyon, the director of photography for AP.

The row reflects rising tensions over the impact of the death toll on an already wavering American public, with support for the war dwindling and President Barack Obama warned this weekend by leading Democrats that any attempt to send more troops is likely to meet resistance in Congress.

It also recalls the controversy four years ago when the Pentagon finally released pictures of flag-draped coffins returning from Iraq, overturning a ban imposed in 1991 on the US media photographing military caskets in transit.

In that case, the concerns of families were also repeatedly cited as justification for suppressing images of the dead, and they were only published after a freedom of information request by a professor of journalism, who argued that they were a matter of public record. By contrast, the British media has regularly covered the return of coffins.

In extracts from her journal published by the US website huffingtonpost.com, Jacobson described the moment when she watched a marine lose his life "for the second time in my life". "He was hit with the RPG which blew off one of his legs and badly mangled the other... I hadn't seen it happen, just heard the explosion." She described how she heard Bernard calling out that he could not breathe, and his friends telling him he was going to make it.

About 20 American newspapers and some websites used the image, sent out alongside photographs of Bernard's life in uniform and his memorial service, last week, but it was taken on 14 August when Bernard's patrol in the village of Dahaneh was ambushed. He was airlifted to the US base at Camp Leatherneck but died there of his wounds, the 19th American to lose his life in Helmand that month at the height of the fighting.

AP said the images had been shown to his family in advance, but said that reporters had not specifically asked the family's permission to publish, admitting that his parents had not wanted the photographs to be used.

The son of a retired marine, Bernard, from New Portland in rural Maine, was described as a devout Christian, an Iraq war veteran, a keen snowboarder and an avid hiker. His father, John, described him as a "humble, shy, unassuming" man who did not smoke or drink and whose main friends were from his church group. Three weeks before Joshua died, Bernard Snr had written to his congressman expressing frustration at what he said was a change in the rules of engagement to spare civilians, calling the move "disgraceful, immoral and fatal" to American forces in combat.

Asked to sum up his son, John Bernard suggested the words "service and personal honour".

But as America continues to debate the use of his image, Joshua Bernard has now come to symbolise something more: the suffering inflicted on America's sons and daughters in uniform, and the unease of fellow citizens forced to confront the grim truth about their deaths.