In the psychological thriller “Stay,” a character says that all the world is an illusion, a statement the film seems desperate to make.

Directed by Marc Forster, “Stay” follows the story of Sam Foster (Ewan McGregor), a psychiatrist charged with helping a troubled young man, Henry Letham (Ryan Gosling). The doctor and patient never really establish a rapport, and while Letham is openly hostile to the psychiatrist, he admits that he keeps returning because he knows that Foster is the only one who can help him. Soon Foster begins to question his own grip on reality when Letham begins to offer disturbing predictions that one by one all come true.

During a particularly volatile session, Letham confides in Foster that he will kill himself at midnight in three days, on what would be his 21 birthday. When Letham disappears on the eve of his announced suicide, Foster sets out on a desperate quest through the city to save his new patient.

With “Stay,” director Marc Forster has created a nightmarish world where reality and hallucination blend seamlessly to the point where neither the characters nor the audience truly know what is happening. Time seems to be malleable, stopping, slowing down and speeding up, offering no consistency to comfort viewers. Scenes and characters morph fluidly into one another, or repeat in a broken-record fashion, with the camera angle changing slightly each time, creating a jagged, anxious effect.

The confusion is heightened when Forster utilizes quick cuts of extreme close-ups with an unsteady camera, creating an kinetic, confusing look that reflects the characters’ own struggles. Forster is also able to depict the characters’ view of reality by including several shots reflected through stained glass or a polished metal surface. The inclusion of several Hitchcock-inspired shots and camera angles, such as a “Vertigo”-style spiral stairwell scene, add to the film’s dreamlike state.

McGregor’s portrayal of Foster is remarkable. He remains convincingly confused through the film, playing what seems to be the only sane man surrounded by lunatics, but who himself is slowly losing his sanity. He also displays great range as he shows both vehement rage at Letham for leading him on a search through the city and incredible vulnerability in his dealings with his girlfriend Lila (Naomi Watts), a former patient who tried to commit suicide. Foster grows more pale and haggard as the film progresses, a physical testament to the strain he is suffering while trying to save a patient, and perhaps himself in the process.

Gosling is also impressive as Letham, displaying the disheveled, unwashed-hair-in-his-eyes appearance, emotional vulnerability and violent mood swings that one would expect from someone wrestling with mental issues, but delivering it with eyes that evoke a prevailing sense of calm that let the viewer know something is not exactly as it seems. The scenes dealing with his predictions are truly creepy, especially when he says what Foster is saying to him as he’s saying it. It is intense dialogue that would be tacky if left to lesser actors.

Fans of films such as “Memento” and “Lost Highway” will to want to check out “Stay,” but be warned: bring a thinking cap. The nonlinear plot and dreamlike cinematography beg repeat viewing in order to find hidden clues to decipher what is happening, which by the end of the movie is still not clear. That notwithstanding, “Stay” is a gripping, interesting film for anyone who enjoys inventive, cerebral filmmaking.