Roohollah Zamani and Shamila Shirzad in Sun Children (Strand Releasing)

Stylish and gritty. Exultant and tragic. Majid Majidi’s story of a pugnacious homeless boy fighting to survive on the streets of Tehran delivers just enough charm to give you hope for his future. The film’s end may be far from happy, but along the way, Majidi generously creates moments that uplift and feel precious in the best sense of the word.

Ali (Roohollah Zamani), aged12 or so, his freckled face hardened by adult pressures, leads other kids in a car theft in a garage. The camera tightens on struts, wheels, levers—a focus on mechanics that is part of the movie’s grounding in the greasy scrap yards and narrow alleys of Tehran’s dense urbanscape. When caught by a security guard, the children run away in a loosely but beautifully choreographed burst that ends with an epic overhead shot of the group bathing in a fountain. It’s one of a number of ably executed moments of freedom that lighten a story that grows heavier as it goes along.

The Artful Dodger–like Ali scrounges for money and barely gets to see his mother, who lies supine in a home for the mentally ill. The only affection in his life comes from Zahra (Shamila Shirzad), a vulnerable little girl forced by her family to sell socks on city buses. When Ali attempts to cheat the gang capo, he gets caught after a hot rooftop pursuit. The dry, sinister boss presents the boy with a chance to show penance and claim a share of a big score—an offer Ali can’t refuse.

The scam will force Ali to go undercover at a ragtag school for homeless boys, where the gangster instructs him to dig for a buried treasure in the underground tunnels that hold Tehran’s water supply. Ali will have to beg to gain admission to the school, pose as a student, and head to the basement to dig without anyone copping to his ruse.

Unexpected developments affect Ali inside the classroom. Although the school administrators are overworked and sometimes cynical, they are kind men who genuinely care about their students, and the tough boy responds to their attention. Ali forms a bond with a teacher (and shows him a street-fighting technique that will prove useful later). When he feels the authorities are on to his scheme, Ali comically moans, begs to stay, and fights expulsion. His tenacity is admirable and so is his sheer loudmouthed gall, milked for humor by the director.

This Iranian film contains many echoes from other cinematic traditions. Ali’s emotionalism and brazenness recall an anti-hero from Italian neorealism. Perilous scenes of Ali drilling in darkness bring jailbreak movies to mind. The protective rapport between Ali and Zahra feels Disney–esque, but less sentimental. And a groundswell of boys defending their school imperiled by city authorities brings Disney to mind again, only with a raffish Dickensian energy.

Director Majidi (The Song of Sparrows) keeps these stylistic flourishes from feeling artificial with a scrupulous focus on his story. His steadfast affection for his wretched yet proud, decent, and persevering main character suffuses the film with a spirit that transcends the misery of life underground (literal and figurative). The treasure Ali finds is not what we expect, but we have uncovered riches along the way.

Directed by Majid Majidi
Written by Nima Javidi and Majidi
Released by Strand Releasing
Farsi with subtitles
Iran. 109 min. Not rated
With Roohollah Zamani, Ali Nassirian, Javad Ezati, Tannaz Tabatabaei, and Shamila Shirzad