Retired Marine corporal Megan Leavey and her service dog, Sgt. Rex, were the guests of honor at Yankee Stadium on Sunday, when they starred in a pregame ceremony designed to act as both a homecoming and a celebration.

Leavey, who has been out of the service since 2007, worked tirelessly to secure Sgt. Rex's adoption post-retirement, and she's had the barrel-chested German Shepherd in civilian life for a little more than a month. And there they were on Sunday, feted for their service and for their unbreakable bond.

"He's just living the retired life," Leavey said of her robust companion. "Wake up, eat breakfast, lounge around the yard and play with your toys. He can do whatever he wants."

Sgt. Rex, 11 years old, suffers from a case of facial palsy, but Leavey said it hasn't really affected his quality of life. Leavey said that the former service dog has blended seamlessly into her home life, patrolling her fenced-in yard and playing with the two dogs that make up her civilian family.

Leavey and Sgt. Rex spent two tours in Iraq together working as a team to discover improvised explosive devices, and they even rehabbed together after getting injured in the line of duty. One day, she and Rex were targeted by a remote detonation of an IED, and both were incapacitated. Leavey suffered a traumatic brain injury and hearing loss, while Sgt. Rex injured his shoulder.

For nearly a year, they worked together to heal up at California's Camp Pendleton.

Now, Leavey wants nothing more than to allow Sgt. Rex to live out the rest of his life with dignity.

"It was very, very hard for me to have to leave California not knowing if I'd ever see him again," she said. "And then just going through all those years not being together ... was kind of a waiting game. Once I actually realized it was going to happen, I was just so happy. It was like a weight lifted off my shoulders. It's amazing. He's home, he's happy and I get to take care of him for as long as he has left."

It could've been a different outcome, and nobody knows that better than Leavey, who spent years petitioning the government for Sgt. Rex's early release. Sgt. Rex was still classified as an active dog, but Leavey feared that he would be euthanized as soon as he was no longer capable of serving.

With that prospect in mind, Leavey went to work. She went through proper channels and devotedly tried to secure his adoption as soon as it was possible. Her story became a cause célèbre, which made it easier for the military to decommission Sgt. Rex and give him a good home in one swoop.

Still, it was five long years in between leaving Sgt. Rex and getting him back again.

"This dog had saved my life. He was my partner," she said of their bond.

"In Iraq, he searched for IEDs. And he's found a lot. ... Before we got injured, we had already been on one deployment together. We had probably already been together about two years. And when you're a dog handler, you're with this dog 24-7, all the time. You develop a really close bond. You know everything about the dog."

Leavey, who now works as a dog handler in civilian life, said she joined the military in part because she was unfulfilled by her first two years of college. She initially joined the Marines with the aspiration of becoming part of the military police but tested into the service's elite K-9 handling unit.

And that's where she met Rex, who's technically her superior officer. Sgt. Rex had already served one tour without her, and he served another two tours in Iraq under her supervision. They were working together in 2006, in fact, when they were both seriously injured in the line of duty.

Leavey retired from the Marine Corps in 2007, but Sgt. Rex stayed behind at Camp Pendleton as a dog in active non-combat duty. Leavey tried to keep in touch with his handlers as much as possible to find out how he was doing, but she also actively embarked on a campaign to secure his future.

That journey must've seemed hopeless at times, but Leavey eventually won Sgt. Rex's release and was able to attend his retirement ceremony at Fort Pendleton. That ceremony -- which Sgt. Rex reportedly barked through -- also served as their official reunion, a tear-making moment five years in the making.

"I didn't get any alone time with him or anything, so everybody was outside," said Leavey. "He was all ready and waiting, and everybody was pretty much watching our first meeting together. He was wagging his tail, and during the ceremony he was looking up at me. It was just really cool."

Leavey, who grew up and still resides in nearby Rockland County, said that Sgt. Rex eats the same food he did while serving in the military and that he still inspects rooms -- and planes -- as a matter of course.

Leavey lauded Randy Levine, the president of the Yankees, and his wife, Mindy, for helping her make the trip to retrieve Sgt. Rex, and said she was extraordinarily grateful for the public's reaction.

"We had this big dog flying in first class. Everybody was so nice," she said of the flight home. "Here we were in first class with Rex sleeping at our feet. He was so good. He slept the whole plane ride home. And to my surprise, when we got off the plane, my dad was there and all the TV cameras were there. They had the bagpipes playing the Marine Corps hymn. It was such a nice homecoming.

"Strangers -- people that I don't even know -- have been so supportive and nice. We couldn't have been here today without everybody's support and help. It's just so kind."

Spencer Fordin is a reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.