Image caption Kristen Scott Thomas said she took the role in Only God Forgives so she could work with Refn (left)

Ryan Gosling's new film Only God Forgives has divided critics at the Cannes Film Festival with its extreme violence.

There were walk-outs and boos at its screening earlier but it has still earned some glowing reviews.

Gosling plays a drug smuggler in Bangkok who is compelled by his mother to avenge his brother's death.

Peter Bradshaw from The Guardian gave the film five stars but said it might "have people running for the exits."

The film reunites Gosling with director Nicolas Winding Refn, who won the best director prize at Cannes for their 2011 collaboration Drive.

Bradshaw praised Refn's "bizarre infernal creation".

"An entire created world of fear, really is gripping. Every scene, every frame, is executed with pure formal brilliance," he wrote.

Speaking to reporters at Cannes, Refn said he felt powerless to resist a compulsion to depict violence on screen.

"Art is an act of violence," he said on Wednesday. "Art is about speaking to our subconscious and our needs at different levels."

Gosling did not attend Cannes this year, being currently in Detroit directing his first movie How to Catch a Monster.

Cannes director Thierry Fremaux read a letter from the Canadian actor at the film's press conference apologising for his absence.

Image caption Ryan Gosling in Only God Forgives

"Can't believe I'm not In Cannes," Gosling wrote. "I was hoping to come but I'm on week three shooting my film in Detroit. Miss you all.

"Nicolas, my friend, we really are the same persons in different dimensions. I'm sending you good vibrations.''

Kristin Scott Thomas is cast against type in the film as Gosling's garishly dressed American mother.

"Watching her in Only God Forgives is like waking up to discover your much-loved pet cat has morphed overnight into a saltwater crocodile," wrote the Daily Telegraph's Robbie Collin.

"Kristin Scott Thomas easily upstages Ryan Gosling's near-catatonic turn," wrote Variety's reviewer.

Scott Thomas admitted to reporters that the film was "really not my thing," admitting she did not enjoy watching films "where this kind of violence happens".

But she said she took the role to be able to work with Winding Refn and play a "wild, savage person".

The film, out in the UK on 2 August, is one of 20 in the race for the festival's Palme d'Or prize.