The oddest thing about “Megan Leavey” is its title. After all, Shakespeare never titled his great romances simply “Juliet” or “Antony.”

Admittedly, Megan (made both sympathetic and resolute by Kate Mara) is on-screen a lot more than her sweetheart: a German shepherd employed by the military to sniff out explosives. But viewers of this fact-based weepie are likely to prefer the emotionally versatile Rex (impersonated mostly by Varco). He’s gruff with strangers but soon reveals his puppy-dog eyes.

The two characters are, of course, made for each other. Surly and solitary, Megan is feuding with her mother and stepfather (Edie Falco and Will Patton) when she impulsively decides to enlist in the Marines. That propels her toward Rex, the bomb-sniffer least likely to be voted Mr. Canine Congeniality. The two become partners only after Rex has violently sidelined his previous handler.

Megan Leavey (Kate Mara), the film’s titular figure, with Rex, a German shepherd employed by the military to sniff out explosives in Gabriela Cowperthwaite’s narrative debut. (Jacob Yakob/Bleecker Street)

Once Megan and Rex bond, however, the pooch becomes gentle and protective. He doesn’t even get jealous when Megan develops feelings of a different sort for a biped: fellow dog handler Matt Morales (Ramon Rodriguez). Most important, Rex keeps his cool after he and Megan start serving as one of the first female-led explosive-seeking teams among U.S. troops in Iraq.

The context for the military conflict is quickly sketched by a scene in which then-Secretary of State Colin Powell’s war-justifying 2003 speech to the United Nations plays on a TV. But the subject is never raised again. Megan, a New Yorker, is apparently too busy rooting for the Yankees to ponder the wisdom of the invasion by the United States, even after it blows up in her face — literally.

Ramon Rodriguez as Matt Morales. (Jacob Yakob/Bleecker Street)

Common as Gunny Martin. (Jacob Yakob/Bleecker Street)

In and around the city of Ramadi, Rex’s nose locates bombs and guns, leading Megan and her cohorts through numerous scrapes. The movie isn’t exactly “The Hurt Locker,” but it does convey a frantic sense of the battle experience. There are even sequences shot from Rex’s height to suggest a dog’s-eye view of war.

When Megan and Rex’s luck goes cold, both are wounded, psychically as well as physically. She gets a Purple Heart and a discharge; he gets sent to Afghanistan. Megan’s bid to bring Rex home with her is overruled by a ferretlike Marine veterinarian (Geraldine James), who decides that he’s too dangerous, a decision that’s enforced by Megan’s tough-but-fair sergeant (Common).

Back in civilian life, a mopey Megan regains her warrior spirit only when her dad (Bradley Whitford) encourages her to go public with her campaign to win custody of Rex.

Clearly pitched to animal lovers, “Megan Leavey” marks the narrative debut of documentarian Gabriela Cowperthwaite, whose 2013 “Blackfish” — about the treatment of captive orcas at marine parks — was actually more harrowing. This movie is rarely more than merely competent, but it should stir lovers of justice as well as dog fanciers. If there’s anything more heartwarming than a loyal animal companion, it’s teaching an impersonal bureaucracy to roll over and fetch.

PG-13. At area theaters. Contains war violence, strong language and brief sensuality. 116 minutes.