His three combat tours in Afghanistan had been boiled down to a 38-second video clip, played and replayed on YouTube more than a million times. In it, Rob Richards and three other Marine Corps snipers are seen urinating on the bodies of Taliban fighters they had just killed.

“Total dismay” were the words then-Secretary of State Hillary Rodham Clinton used to describe the video when it surfaced on the Internet in January 2012. “Utterly deplorable,” agreed then-Defense Secretary Leon Panetta. Richards’s career in the military was finished.

More than two years later — long after the rest of the country had moved on to other scandals — Richards, 28, died at home and alone from an accidental painkiller overdose.

Now an ammunition can carrying his cremated remains sat on the table of a hotel bar in Arlington, Va., as his family, friends and fellow Marines swirled around it.

Almost everything about war is complicated, messy or morally fraught; in this case even more so. A Marine vilified by his country’s leaders and court-martialed for “bringing discredit to the armed forces” would soon be buried at Arlington National ­Cemetery, the country’s most hallowed ground. On this mid-February night before the funeral, dozens who knew Richards beyond those 38 seconds gathered to celebrate his life.

Rob Richards, seen July 2014, felt abandoned by the Marine brass who had heaped praise on his unit. (Courtesy of Raechel Richards)

Richards’s mother spotted her son’s platoon commander and platoon sergeant, both of whom were in the video, ordering drinks at the bar. “My boys, my sons,” she called out to them. The two men are out of the Marine Corps now and have thick beards and long hair.

The platoon sergeant rolled up the sleeve of his sweatshirt to show off a memorial tattoo bearing Richards’s name on his wrist. “Right where everyone can see it,” he said.

Richards’s mother, Cate, a senior sales executive for IBM, hugged him and rested her head on his shoulder. When Richards was a sniper team leader in Afghanistan, she sent him regular care packages with items he and his Marines most needed. Her weekly shopping list included clean socks, cans of Chef Boyardee and six packs of Red Bull to help them stay alert in their hide sites while they watched for the enemy.

“Sniper den mom,” they called her back then.

The bar was filling up with Marine snipers telling war stories. “Remember that Mark 12 gunner who got three head shots at 1,000 yards,” one of the Marines was saying.

Richards’s mother was showing her brother a memorial photo album — set out next to the ammo can — that told another version of her son’s life. “That was his first pony ride when we were in the Philippines and his dad was an Air Force pilot,” she said. School photos gave way to snapshots of Richards’s boot camp graduation and then Richards’s tours in Afghanistan.

“That’s his first deployment,” she said. “He lost so much weight.”

On the next page, Richards was shirtless and hobbling down a hospital corridor after his second tour, which was cut short by a buried bomb. Shrapnel from the blast tore through his legs and punctured his neck, leaving him unable to speak for weeks. He was still recovering at Walter Reed when he learned that one of his Marines, Josh Desforges, had been killed.

“That was the only time I heard him crack,” his mother said. “He was begging to go back to Afghanistan, even though he had a hole in his throat.”

A few pages later Richards was hugging his wife goodbye as he headed off for tour No. 3.

Several Marines gathered around Richards’s mother. It was late, and everyone had been drinking. His platoon commander started to tell the story of the video — a story that he has told dozens of times over the past two years. This time he picked it up at the moment when they were all standing over the Taliban fighters’ blood-stained corpses, just before the camera began recording. “Someone said, ‘Piss on these guys,’ ” he was remembering. “And someone else was like, ‘Yeah, you know what, let’s piss on them.’ ”

Richards’s mother dropped her eyes, and he stopped telling the story.

“I’ve always been proud of you boys,” she said.

The platoon commander took a gulp of his whiskey. “You had the pleasure of raising . . .” he said, searching for the right words.

Another Marine finished the thought: “the baddest Marine ever.”

Hallowed ground

The next morning, a Marine in a dark overcoat held the ammo can with Richards’s remains in two white-gloved hands and marched slowly toward the grave site. On one side of the metal box was a stencil of crossed rifles, superimposed over a skull that’s been pierced by a sniper’s bullet. On the other was a favorite Hemingway quote that his family had put there because it seemed to sum up Richards’s life and his eventual death: “There is no hunting like the hunting of man, and those who have hunted armed men long enough and liked it, never care for anything else thereafter.”

The Marine set the box down on a small riser in front of Richards’s mother, his wife and his grandfather, an 83-year-old combat veteran, clad on this day in his Army dress uniform. Behind them about 300 mourners had gathered.

A Navy chaplain stepped to the front and delivered another version of Richards’s life. “He served with honor . . . gave so much . . . and bled for our freedom,” the chaplain said. “Today we lay him to rest in a fitting place.” A volley of rifle fire delivered a salute followed by a lone bugler who sounded taps. An honor guard of Marines then folded an American flag that had been suspended over the ammo box into a tight triangle. Their movements were perfectly choreographed, precise and controlled; nothing like Richards’s war.

Most Marines in Afghanistan rarely saw the enemy, who fired at them from behind walls or blasted them with pressure-triggered land mines. Snipers, such as Richards, were the exception. They stalked the Taliban, watching them for hours through their scopes as they planned attacks, shared meals and went about their day. “Every single mission we came back with multiple kills,” said former Sgt. Edward Deptola, Richards’s platoon sergeant. “There would be two, three, four, five, sometimes 15 kills.”

There was a relentlessness to their war. But, on some days, there was also a joy to it. After shooting a Taliban fighter, Richards and Deptola would often slap hands. Sometimes Richards would do a little celebration dance. “To the average guy, you’d look like a complete psychopath,” Deptola said. Over there, he said, “It made perfect sense.”

The down time between missions — recuperating and waiting for another assignment — was often the hardest part. “We’d be like crack addicts,” Deptola recalled. “We were on that adrenaline drug. We’d get our high when we killed people, and the only way to get our high was to kill. We were honestly addicted to killing people.”

The more Taliban they killed, the more praise they received from the top brass. The commandant of the Marine Corps set aside a morning to have breakfast with them and laud them for their work. Richards’s commanders recognized his battlefield valor by nominating him for a Bronze Star.

On the day the video was filmed, the snipers had pushed out farther than ever before from their patrol base, searching for a cell of fighters who had killed one of their Marines and then hung one of his limbs from a tree, Deptola said.

The snipers were about 50 yards from the Taliban when they shot them. Seconds after the enemy fighters fell, a boy, who was standing with the men, grabbed a rifle and pointed it at the Marines. Richards shot the boy one time in the chest, wounding but not killing him. Usually, the Marines left the bodies of the Taliban fighters for the locals to bury. This time, perhaps because they were already so close, their commanders ordered them take the bodies back to their base so Marine Corps intelligence could search them, Deptola said.

The snipers were buzzing with joy, anger and adrenaline as they approached the enemy dead. Then came the moment just before the video. Then came the 38 seconds, and now several years later, Deptola was explaining why they decided to urinate on them.

“Because killing them wasn’t enough,” he said. “That wasn’t enough justice.”

Finding purpose in war

After the funeral, the mourners gathered at a bar in Georgetown. Richards’s wife, Raechel, was talking with his company commander from his last Afghanistan tour. The Marine officer wasn’t with Richards on the day the video was recorded, but it still ended his career. Richards often said that his only regret from the day was that his actions had compromised the careers of his superior officers.

“He’s where he deserves to be,” the officer told Raechel, before thinking twice about how his words must have sounded to a grieving widow. “That’s not what I meant. I wish I could have done more.”

She touched his arm to let him know it was okay.

Raechel was still in high school when she met her future husband, who had just graduated and was drifting half-heartedly through community college. He was restless, outgoing, romantic and impulsive. “Going to war was his purpose,” she said. “It’s what he was meant to do.”

More than anyone else, she had seen the toll that combat had taken on her husband. After he was wounded during his second tour, Richards suffered from sleeplessness and night terrors. On a short vacation in Tampa, Fla., he had mistaken a sudden loud boom for an enemy attack and fired his pistol through a mirror in their hotel room.

Nine months after the incident, he turned down an instructor position at Marine sniper school and volunteered for his third tour. His wife begged his platoon commander to make him stay home and heal. “He may look like he’s ready,” she recalled saying. “But as his wife, as the person who sees him when he sleeps at night, I don’t think he’s ready.”

The video appeared on the Internet a few weeks after Richards returned home from tour No. 3. “Well it looks like I’m going to be famous,” he said a few hours after the video first surfaced on the TMZ gossip Web site. At that moment, Naval Criminal Investigative Service investigators were waiting to interview him.

As the months passed, Richards worried that the 38 seconds would follow him for the rest of his life. The investigation and court-martial took nearly two years before the Marine Corps offered Richards a plea deal that reduced him a rank to corporal and allowed him to leave the military with an honorable discharge. Richards felt abandoned by the Marine brass who had heaped praise on his unit when they were killing Taliban. He had hoped to get into defense contracting after the military, but he worried that no one in the industry would ever hire him.

“He felt backed into a corner,” his wife recalled. “He always said, ‘It’s all I’ll ever be known for.’ ”

After the military, Richards fell into a depression and became addicted to opiates. Eventually, he went through drug counseling. He and his wife separated briefly and then reunited after he had finished treatment.

Their last few months together were some of the best of their marriage, Raechel was now telling his former company commander. “He was coming to terms with the fact that he was not going to be a Marine anymore and was going to have to be something else,” she said. Nearby a Marine was passing out sniper rounds filled with locks of Richards’s hair and gunpowder.

“He was finally coming to terms with it,” she said again.

A few days before he died, Richards and his wife had put in an offer on a house near Orlando, where they both had attended high school. They had already begun to box up their possessions for the move from their home in Camp Lejeune, N.C.

On his last morning alive, Richards ordered books for the community college courses that he planned on taking in Florida. As his wife was rushing out the door to work, he playfully asked her to dance with him. She noticed that his hands were clammy and his skin was pale.

She came home from work that evening and found his body on the floor outside the kitchen. Later doctors would speculate that his weakened liver had been unable to metabolize the prescription painkillers that were slowly building up in his system.

There are many reactions to seeing death: Raechel’s was disbelief. “Not like this,” she would remember screaming as she stood near her husband. “Not like this.”