(CNN) -- Lex attended the funeral of his best friend in March, playing with the 20-year-old Marine's younger brother away from the crowd. He was beside Cpl. Dustin Lee when Lee was killed in a mortar attack in Falluja.
Cpl. Dustin Lee, slain in Iraq in March, with his dog, Lex, who is going to live with Lee's family.
Wounded himself, Lex didn't want to leave Lee's side after the attack -- fellow Marines had to pull him away from the young man's body so medics could do their work.
Although some shrapnel remains in his body, Lex recovered from his wounds and returned to duty at the Marines' Logistics Base in Albany, Georgia, to await a new assignment.
On Friday, Lex gets that new assignment -- retirement to Lee's family home in Quitman, Mississippi, where the 8-year-old bomb-sniffing German Shepherd will live out the rest of his life.
Jerome Lee, the young Marine's father, lobbied the Marines hard for months to adopt the dog. Marine officials initially told Lee that it would be no problem to get the dog. But persuading the service to give up Lex before the dog's mandatory retirement at age 10 proved to be a challenge. Watch Dustin's father describe how the family struggled to adopt their son's dog »
"Since Dustin's death we've been trying to get his dog, Lex, from the Marine Corps, and needless to say we've had some difficulty there," said Lee, a Mississippi Highway Patrol officer. "This thing went from colonels to generals all the way up to the commandant of the Marine Corps, and it almost went to the secretary of defense."
One of the issues was making sure the dog was not "overly aggressive." His behavior with the Lee youngsters -- Lex played tug-o-war with 13-year-old Camryn at Dustin's funeral -- seemed to assure that wouldn't be a problem. Marine officials also said the request had to go through the Air Force, which is the approving authority for all military dogs.
Finally, on December 13, the Marines agreed to let Lex live with Lee's family. It was the first time the Marines have released a dog before its retirement to a former handler's family.
"Lex has had two tours in Iraq," said Jerome Lee. "He's been through a lot, and we just want to get Lex home to our family, and let him have a happy life."
Well before joining the Marines, Dustin Lee was known by all for his devotion to his country. A member of Quitman High School's cross-country track team, Lee and three teammates participated in the Americans United: Flag Across America Run after the September 11, 2001, terror attacks on New York and Washington.
So it was no surprise when the young man joined the Marines out of high school in 2004, nor was it a surprise when he went to Albany to train military police dogs, inspired by his mother's work with the county's search and rescue team dogs when he was a boy.
Dustin, an animal lover who also rode horses, played hide and seek with his mother's canine companion as a child, Jerome Lee said.
"He would let the dog get a sniff of his clothing and then go hide to see if the dog could find him," the elder Lee said.
At the logistics base in Albany, Lee said, Dustin "worked with all the dogs and became the kennel master."
Dustin and Lex had been stationed in Falluja for nearly five months before the fatal attack. When the Marine's body was returned to Quitman in late March, hundreds lined the streets waving American flags to say a tearful goodbye. And Lex was there.
In Albany on Thursday, current kennel master Mike Reynolds led Lex through his paces for the last time in his military career. Now it's time for the old pro to learn some new civilian tricks. In a ceremony on Friday, Lex will join the family of his best friend.
Jerome Lee hopes his other two children will feel closer to their missing older brother.
"There's always going to be that missing link with Dusty gone," he said. "But part of Dusty is here with Lex." E-mail to a friend
CNN's Mike Phelan contributed to this report.
All About Iraq War