Early on in "The First Grader," an ancient man, as hard and lean as his walking stick, strides miles across the coarse Kenyan bush. When he gets to his destination — a rural primary school — the gate is already locked leaving him to stand alone on one side, with everything he wants on the other.

So begins the film based on the life of Kimani Ng'ange'a Maruge, an illiterate 84-year-old Kenyan whose fight to be admitted to the school in 2003 became a Los Angeles Times story and a worldwide sensation. Before it was over, his struggle would alienate neighbors, test teachers, inconvenience politicians, spark violence, trigger a public debate, and ultimately turn him into the poster child for the power of education.

Anchored by a lovely performance from Oliver Litondo as Maruge and an exuberant Naomie Harris as Jane Obinchu, the school principal who champions his cause, the result is a tearful, joyful, imperfect, yet nearly irresistible ode to the human spirit.

The filmmakers — director Justin Chadwick ("The Other Boleyn Girl") and screenwriter Ann Peacock ("The Chronicles of Narnia: The Lion, the Witch and the Wardrobe") — whose earlier work trafficked in history and literary myths, come down to earth for Maruge's saga. For the most part, they have put enough real world grit in the story to help a heaping sentimental spoonful go down.

Using a rangy mix of humor, terror, defiance and irony, the film moves between Maruge's memories of his life as a young father and warrior in the Mau Mau rebellion against British colonialism and his later days' determination to read. The past through cinematographer Rob Hardy's lens is lush and ripe and looks poetic until it dissolves into brutal and bloody bush warfare. It is also the film's weakest link as the filmmakers reduce a complicated history of tribal conflicts, British rule and Maruge's experience to a shorthand of images that raise more questions than they answer. In contrast, the school, though simple, impoverished and covered by a layer of desert dust, has such vibrancy it lifts the film every time the director returns there.

Though this is one man's story, the film is peppered with eccentric characters who keep things interesting, led by a Greek chorus of old-timers who drink beer and pass judgment on Maruge's daily pilgrimage to class and the absolute hoot of popular radio talk show host, DJ Masa (Dan Ndambuki), whose giddy outrage keeps the pot stirred. But the scene stealers are Maruge's young classmates — a mishmash of soulful eyes, cherubic smiles and mischief — all cast from the Rift Valley school in Kenya where the film was shot. In showing the kids, as well as Maruge, bloom under Teacher Jane as she is called — an indefatigable force in Harris' hands — the film captures the essence of why education is so empowering, why learning to read was worth Maruge's fight.

Litondo, a '70s-era Kenyan TV news anchor turned bit actor, steps easily into his first leading role, bringing a compelling dignity and determination to Maruge. Chadwick makes the most of Litondo's regal bearing and expressive face, creased by the years, often letting the camera linger there.

Harris matches Litondo's fierceness and prickly persistence with her own. The London-born actress drew early notices for 2002's "28 Days Later," but may be better remembered for the black magic she worked as Tia Dalma/Calypso in two of the "Pirates of the Caribbean" films. Though she was quirky fun in a cast of thousands, here she is almost alone center stage. But it is Maruge's tale after all, and when the action takes Teacher Jane away from the school — to the trials it brings her marriage, to the blowback on her career — all the bright colors Harris has given the character begin to fade.

It is far from her problem alone. The film as a whole would have been better served if the director had kept his focus on the school — that might have turned this very good effort into an A.