A marvelous new film by the French director Laurent Cantet sits on the cusp between fiction and documentary. Based on François Bégaudeau’s memoir of teaching in a working-class, multicultural Paris high school (the memoir was adapted to film by Cantet, Bégaudeau and Robin Campillo), The Class was shot with nonprofessional actors, and Bégaudeau plays a fictionalized version of himself, a character named François Marin.

Cantet’s documentary realism is fueled by powerful dramatic impulses. Marin is in his fourth year of teaching at the school, and almost all his students are familiar to him from the previous year. We get the sense that rebellious Esméralda (Esméralda Ouertani), who challenges him constantly, has gotten under his skin before now.

Marin gets a charge out of his students, and he entertains their questions, even when they veer from the lesson topic; he’s flexible, and it’s clear that he views their interrogation not as a burden or an intrusion but as essential to their learning. Like any good high school teacher, he sees his students as whole, complicated beings. He keeps his sense of humor, even when some of the kids confront him with the rumor that he’s gay. But he also gets exasperated by Esméralda and her sometime pal, Khoumba (Rachel Régulier).

At faculty meetings, the teachers debate whether they can allow their knowledge of what goes on in students’ homes to affect their treatment of them. The teachers can’t pretend they don’t know as much about the kids as they do.

When the mother of a serious, industrious Chinese student named Wey (Wey Huang) is arrested as an illegal immigrant, the faculty’s sympathies are aroused. The faculty supervisor suggests taking up a collection for her defense and says Wey’s teachers might consider showing up in court to try to influence the verdict in her favor. In a touching moment, one of the teachers, who has just announced that she’s pregnant, passes around champagne in the staff room and, raising her glass, expresses the wish that her own child might be as intelligent as Wey is.

The case of Souleymane (Franck Keïta) is thornier. This student comes to class unprepared; he mouths off at Marin and his classmates; he has a chip on his shoulder and an uncontrollable temper. Marin’s conference with Souleymane’s mother, a magnificent woman in African garb and with the mien of a tribal queen, yields no useful results: sitting in his classroom, her anger barely tamped down, she contradicts Marin’s complaints about her son. Marin hears from Khoumba that if the boy is expelled his father will send him back to the Mali village where the family came from.

There’s a brief period when we think Marin has found a way to engage Souleymane: an assignment on self-portraits brings out his talent as a photographer, and the boy warms to his teacher’s praise. But the connection doesn’t last. He curses at Esméralda in class, so Marin has to send him to the principal’s office. On another day, Esméralda and another girl, Louise (Louise Grinberg), who as elected student representatives have the right to sit in on the faculty discussions, tell Souleymane that Marin “wiped him out” when his name came up. That leads to another explosion in class.

Marin’s anger is aimed mostly at the girls for their indiscretion, and his words are ill chosen. The film doesn’t attempt to whitewash him: he says things that he can’t unsay and aggravates the situation by getting into a follow-up quarrel with the girls.

The Class is a portrayal of secondary-school teaching as a great humanistic endeavor, and it wouldn’t be as convincing or as moving if it weren’t so honest. The viewer leaves feeling hopeful about the teaching profession.