Phiona Mutesi’s life was begging to be made into a movie. It’s not every day that a barely literate girl emerges from a slum to become a national chess champion even before she has reached voting age.

Mutesi’s remarkable talent inspired the biography The Queen of Katwe: A Story of Life, Chess, and One Extraordinary Girl's Dream of Becoming a Grandmaster by Tim Crothers, which has been adapted as the biopic Queen of Katwe. Directed by Mira Nair and based on a screenplay by William Wheeler that draws from Crothers’s book, Queen of Katwe is a stirring account of human resilience that survives its saturated and sun-flooded look, its cheery tone and the bumper-sticker dialogue.

Mutesi is now around 20 (her birth year is unclear), and she appears in the end credits alongside Madina Nalwanga, who beautifully plays her younger self. Phiona has been forced to drop out of school and is selling maize and lugging water for her impoverished family in the Katwe slum in the Ugandan capital Kampala. Yet , her doughty mother Harriet (Lupita Nyong’o) wants to make sure that Phiona does not become anything like the wayward older daughter, Night.

‘Queen of Katwe’.

Phiona’s hardscrabble early years run parallel to the heroic efforts of Robert Katende (David Oyelowo) to teach chess to slum children through the government-funded Sports Outreach Institute. When Phiona wanders into the oasis of cleanliness and nourishment that Robert has created in Katwe, she is initially here for the serving of porridge. But she is quickly fascinated by the movement of black and white on a provisional board and the information that chess is the only game in which the queen may be toppled by a humble pawn.

The post-colonial elite that enjoys the lingering benefits of British rule (Uganda gained independence as late as 1962) is present in their clean-pressed uniforms and sense of entitlement at the school that Phiona and other chess club members – dubbed the “Pioneers” by Robert – enter in awe and embarrassment for the first major tournament of their lives. In a moving sequence, Robert checks in on his wards the night before the game to find that all of them have chosen to sleep on the floor rather than the bunk beds.

Phiona’s ascent to prodigy status is no cakewalk, and her mother emerges both as lodestar and conscience keeper. Harriet wants the best for Phiona, but she worries ever so often about her steady progress. She complains to Robert that her daughter has come back with a swollen head after winning a match, but dresses up in her best dress and flirts with an old associate to get her hands on money for extra paraffin so that Phiona can read her chess books at night.

Lupita Nyong’o as Harriet.

The mother-daughter scenes challenge the eye ducts, while the charming cast of mostly non-professional children supply the grin quotient. Ethan Nazario Lubega is a hoot as Benjamin, a diminutive Pioneer who does not let his stature prevent him from defeating a well-heeled schoolboy. Nyong’o and Oyelowo are wonderful in their roles, and they generously share the screen with the children, whose thrill at being in a movie is truly infectious.

Nair is on firmer ground in Queen of Katwe than in her previous Hollywood outings (Vanity Fair, Amelia, The Reluctant Fundamentalist). The director undercuts the inspirational theme with a refusal to attribute Phiona’s victory to external forces. The grimness of the Katwe setting has been mildly dressed up for the purposes of delivering a biopic that can resonate throughout the world, but there is never any doubt about the obstacles that refuse to leave Phiona’s path. Her brother’s accident empties out the family’s meagre earnings, while a monsoon flood wrecks their new home. How is one to dream of chess in such circumstances, she mournfully asks Robert.

The answer is to be found in Katwe, which serves both as a challenge for Phiona as well as the place where she returns for inspiration, and in Phiona’s inner reserves of strength and intelligence. One of Robert’s early lessons keeps Phiona on the right path – chess is about strategy and planning, and the game of life is no different.

Nair ensures that a story of unlikely triumph is a local affair. The queen wins on her terms, and nowhere is Uganda portrayed as a basket case in need of foreign assistance and endorsement. By casting locals and actors from the region and shooting in locations that resemble the real Katwe, Nair delivers a welcome riposte to Hollywood white saviour narratives set in African countries. Robert gets the initially reluctant but eventually firm support of his government, and all of Katwe rises up to cheer Phiona’s progress. This slumdog champion story has a mandated happy ending, but it is satisfyingly hard won.