It was filmed in secrecy, certain scenes were so sensitive they had to be shot abroad and two legal cases were brought this week to try to ban it from French cinemas.

But By the Grace of God, the film by the acclaimed French director François Ozon which took the Silver Bear jury prize at the Berlin film festival last weekend, has finally opened in French cinemas this week amid controversy surrounding the country’s biggest church abuse scandal.

Ozon, best known for his colourful French farces and disorientating thrillers, said he wanted to tackle one of society’s darkest moments in order to ensure that clerical child abuse is “punished and never repeated”. The film deals with child sexual abuse by Catholic priests from a perspective little viewed on screen – the devastating effect on the family lives of a group of men in their 40s who were sexually abused as boy scouts by a priest in Lyon in the 1980s and 1990s and who fought to bring a case to court.

It is the most-high profile dramatisation of the alleged cover-up of clerical sexual abuse since the Oscar-winning Spotlight, set in Boston, was released in 2015.

Crucially, Ozon’s film has been released just as judges are due to deliver a verdict in the first trial related to the scandal. One of France’s most famous Catholic figures, Cardinal Philippe Barbarin, the archbishop of Lyon, was tried last month with five members of his diocese on charges of covering up and failing to report the abuse of scouts by the priest Bernard Preynat several decades ago.

Barbarin is the highest-profile Catholic cleric in France to become embroiled in a child abuse court case. A staunch conservative, he became a household name with his opposition to France’s legalisation of same-sex marriage in 2013. He denies trying to cover up or hide abuse.

The film’s title, By the Grace of God, comes from a now legendary press conference given by Barbarin in 2016 when he shocked France by giving thanks to the lord that alleged abuse dated back too far to be brought to court.

The phrase became so well-known in Lyon that Ozon used a fake working title – “Alexandre” – while making the film in secret in order to avoid the church reacting.

All the interior scenes inside churches were shot in Belgium and Luxembourg to avoid Ozon having to seek permission from Barbarin himself to shoot in Lyon. During production, media were told only that Ozon was working on a project about “three childhood friends who meet again in their 40s”. Unusually for one of France’s biggest filmmakers, funding was hard to come by because of the subject matter. One school head even refused permission for shooting to take place in her building.

But Ozon said this month’s promotion of the film had been harder than filming. Lawyers for Preynat went to court to stop the film’s release saying it violated the priest’s right to be considered innocent until proven guilty. Preynat is expected go on trial for child abuse in Lyon later this year. He has admitted sexual abuse, according to his lawyer. Another female church volunteer who was tried with Barbarin took legal action to ban the film. But judges threw out both cases.

“When you try to break the silence, there is always resistance,” Ozon said. “I don’t think this is happening by accident, because it is a film which is trying to break an omerta, and which deals with the silence.”

When Ozon won the Silver Bear grand jury prize in Berlin last weekend he said: “I want to share this prize with the victims of sexual abuse.”

Ozon based his story on several members of the survivors’ group, La Parole Liberée (Freed Speech), which has gathered the testimonies of 85 people who claim to have been abused by Preynat in Lyon.

One survivor, Pierre-Emmanuel Germain-Thill, said: “The facts were so serious. What we suffered was so bad and the consequences so devastating that we shouldn’t be scared to talk about it, because this could encourage other victims and it could bring change to the way law and society deals with child abusers.”