The Soloist is a rarity—a triumph-of-the-spirit movie in which the hero’s triumph is ambiguous. It’s a movie about accepting small successes and living within your limits.

The character primed to overcome seemingly insurmountable obstacles is Nathaniel Ayers (Jamie Foxx), a man who has schizophrenia and lives on the streets of Los Angeles. In his youth Ayers was a promising Juilliard cellist, and his musical gifts extend to a number of instruments he’s taken up casually. The film’s chief protagonist, however, is Steve Lopez (Robert Downey Jr.), the Los Angeles Times columnist who writes a series of stories about Nathaniel, then tries to set him up in his own apartment and restore him to a life of playing music. Susannah Grant’s screenplay adapts the book that Lopez—a real person—fashioned out of his columns.

Lopez’s role is a fascinating variation on the mentor figure who usually appears in this kind of picture, and Downey gives a fascinating, largely interior performance. Lopez is drawn to help Nathaniel, but he resists Nathaniel’s impulse to see him as his savior. Working out of some personal history the script never reveals, he’s leery of disappointing anyone who puts him on a pedestal. So he fights himself throughout the story. Lopez’s struggles with Nathaniel and with his own role in Nathaniel’s life are the primary drama of the film.

The problem is that Grant has underwritten Lopez’s story, including the scenes that center on his relationship with his editor and ex-wife, Mary (Catherine Keener). With an actor less inventive than Downey the movie would fall apart. Director Joe Wright (Atonement, Pride and Prejudice) lingers on life among the homeless, some of whom take temporary refuge at Lamp Community Center, where Lopez arranges to house the cello that one of his readers donates to Nathaniel.

Wright and his cinematographer, Seamus McGarvey, bring a sense of wonder to the scenes that depict L.A.’s homeless people. The scenes sometimes recall the ambling, improvised feel of 1970s films like Paul Mazursky’s Harry and Tonto, in which Art Carney plays an uprooted senior citizen who takes an unplanned road trip across America. They also brings to mind Terry Gilliam’s The Fisher King, with Robin Williams as a street-bound schizophrenic and Jeff Bridges as his reluctant companion—though Wright’s tone mixes in more melancholy with the comedy, and his style is more majestic and less loony than Gilliam’s. And The Soloist doesn’t share that earlier film’s theme of attaining salvation through putting oneself in another person’s shoes. Grant and Wright don’t suggest that Lopez needs Nathaniel to humanize him, though his friendship with this stranger who always seems to be dressed for a Halloween party does call on emotional resources Lopez didn’t know he had.

Whenever Wright takes us through the streets or into the courtyard of the Lamp Center, we feel we’ve followed Lopez down a rabbit hole. The psychically damaged and the disenfranchised provide a weird Greek chorus; their understanding of the world that Nathaniel inhabits, which is both exotic and frightening to Lopez (as much as he responds with wry humor to his surroundings), validates Nathaniel’s point of view. The ensemble acting in these sequences is close to miraculous. But the style doesn’t turn the corner into expressionism until Wright takes us into Nathaniel’s mind, especially when he experiences music as an abstract spectrum of colors. (McGarvey’s work here is prodigious.)

Lopez takes Nathaniel to listen to Beethoven’s Eroica Symphony at Disney Hall and then hires a cellist (Tom Hollander) to tutor him. The scheme goes awry because of the tutor’s ambition for him and because of his Christian proselytizing. This subplot runs aground—Hollander reads his lines ironically for some reason, so you don’t belive in the character’s religious fervor.

On the other hand, Lisa Gay Hamil ton gives a delicately intent performance as Nathaniel’s estranged sister Jennifer, and it’s a pleasure to see Lorraine Toussaint in the tiny role of their mother, in flashbacks to Nathaniel’s childhood. In one of these, the teenage Nathaniel peeks out the window of his low-rent house to see a flaming car gliding through the street; it’s the late 1960s, and Cleveland’s ghetto is burning. Nathaniel turns back to his cello and buries himself in his music.

This glimpse of an urban nightmare dramatizes the idea of psychic displacement while hinting at the idea that what Nathaniel displaces eventually builds to a fury in his fragile brain. The Soloist is a mixed bag, but its sensitivity and emotional intensity make a powerful impression.