Actress Kate Mara had a tough time bidding farewell to her canine companion in her new war biopic Megan Leavey after bonding immediately onset.

The House of Cards star portrays the titular U.S. war hero, who enlisted in the Marines and joined the K9 Training Unit, where she met her military combat dog Rex, a bomb sniffing expert.

The movie chronicles the marine and hound's deployment to Iraq for two separate tours from 2004 to 2006, during which they helped to save hundreds of lives from roadside bombs, as well as the five years Purple Heart recipient Corporal Leavey, who was injured in combat, spent racing to adopt Rex and save him from being euthanised after retiring from active duty.

For the film, Kate was paired with a German shepherd named Varco, and the actress was pleasantly surprised at how easily the co-stars got along.

"We had really good chemistry, which you never know with a dog," she explained on U.S. breakfast show Good Morning America. "You can't have a regular screen test like you would with an actor, it's just like, 'Well, we hope it goes well!' But yeah, we bonded really, really quickly. It was hard to say goodbye."

The pair was put through its paces during training for the shoot, and Kate admits learning the specifics about a marine's job was among the most challenging aspects of her preparation for the role.

"I did the obvious physical training, but that was sort of the easiest part," she said. "All the other stuff, the weapons training, learning how to march and respond correctly, and of course the training with the dog as well, (was harder)."

And although Kate really enjoyed working with Varco, she admits she constantly felt a little upstaged by her furry co-star.

"Every day, every scene!" she smiled. "Every take we did together, everyone would be watching and (say) like, 'Varco, great job!' and I would be sitting there in tears, I exploded (sic) and no one said a thing about me!"

Megan Leavey, which was directed by Gabriela Cowperthwaite, also stars Edie Falco, Tom Felton, Bradley Whitford, and Common, and is set for release in the U.S. this week (ends09Jun17).