Judi Dench and Steve Coogan make an unlikely but winning pair in Stephen Frears’s “Philomena,” a film that could have devolved into a mawkish tearjerker but, like its stars, maintains a dignified sense of decorum while pushing all the buttons that make for a successful crowd-pleaser. It touches on flashpoint issues—infants snatched from their mothers by an unfeeling and deceptive religious establishment, anti-gay prejudice in the early years of AIDS, faith versus doubt and anger versus forgiveness—but does so with a deftness that avoids melodramatic overstatement while adding a dollop of humor to the mix without coarsening the underlining seriousness.

Much of the credit must go to Coogan, who worked with Jeff Pope in adapting the non-fiction book by Martin Sixsmith, the television journalist and author whom he also plays in the film. Dench is Philomena Lee, a elderly Irish widow who has kept a secret for half a century: she got pregnant in the early 1950s as a teenager and was sent by her disapproving family to give birth to the child at a Catholic convent, where she worked in the laundry as an indentured servant and was permitted only brief visits with her son Anthony. (Flashbacks featuring Sophie Kennedy Clark as Lee portray the repressive treatment Philomena endured at the Roscrea nunnery.) In 1955, the boy was adopted by a wealthy American family—a practice that involved a payment to the convent—and was effectively snatched from his mother, who had been compelled to sign away her maternal rights upon arriving at Roscrea.

Now Philomena aches to find her lost son, and she’s introduced by the daughter from a later marriage, to whom she’s told her story, to Sixsmith, a man suddenly at sea after losing his post as a spin doctor for a government minister. Looking for something to revive his journalistic career, he quickly sells Lee’s story to a publisher as a human-interest piece. And though the nuns aren’t very forthcoming with information—and in the end prove to be positively duplicitous—Sixsmith is eventually successful in tracking down not only Lee’s son but the daughter of another Roscrea girl who’d been adopted along with him. Philomena travels with Sixsmith to the United States in hopes of meeting the grown-up Anthony at last.

It wouldn’t be fair to reveal too much about their discoveries as the journey takes them to Washington D.C. and then back to Ireland for a final resolution at Roscrea itself, since part of the pleasure of the picture lies in learning Anthony’s history as they do. Suffice it to say that the trip reveals major differences in the attitudes of Philomena and Martin, with the former evincing a deep-rooted faith that permits her to forgive even those who have wronged her terribly, while the latter, a cynical agnostic, represents the rage many will feel over what she’s suffered. The overall result is a tale that covers some of the same ground as Peter Mullan’s harrowing 2002 drama “The Magdalene Sisters,” but mitigates its outrage with the balm of Christian compassion.

Giving the story such a welcome dose of complexity is partially due to Frears, whose lightness of touch keeps the material from becoming too strident on either side, but it’s also due to the nicely modulated performances by the leads. Audiences accustomed to Dench’s usually imperious persona will find her in an entirely different mode here. She makes Philomena lovable in her utter lack of pretense, but also endows the woman with a strong sense of decency and a faith that withstands harsh testing. Coogan provides a strong contrast as the worldly sophisticate who finds her devotion inexplicable but comes to respect her for it. Frears indulges the comedic possibilities of the odd couple on a number of occasions, most notably when Philomena, an avid reader of romance novels, insists on relating the plot of one she’s just finished to the increasingly irritated Sixsmith. It’s a long scene that in less capable hands could have curdled; but under Frears’s direction, Dench and Coogan pull it off beautifully. This is largely a two-character piece, but the stars make room for a few memorable supporting turns, most notably by Clark, Mare Winningham as the grown-up version of another fifties child of Roscrea, and Kate Fleetwood and Barbara Jefford as the younger and older versions of Sister Hildegard, a nun whose attitudes represent a different vision of Catholicism from Lee’s.

Technically this is quite a lovely film, marked by excellent cinematography by Robbie Ryan, who is especially successful in bringing a different ambience to the scenes set in the 1950s and the contemporary ones. The visuals are matched by Alexandre Desplat’s engagingly quirky score.

“Philomena” resembles its namesake in being spry, funny, poignant and surprisingly wise. It’s a fine example of how a film can be both incisive in its treatment of serious matters and generously warmhearted, all at once.