Poland has raised jail terms for convicted paedophiles to a maximum of 30 years after a groundbreaking documentary on child sexual abuse among Polish priests prompted public outrage.

MPs voted overwhelmingly in favour of changes to the criminal code that also introduce life sentences for the most dangerous paedophiles and remove a statute of limitations on prosecution of the most drastic cases of child sexual abuse.

The changes introduced by the rightwing Law and Justice (PiS) government, which is closely allied with Poland’s Roman Catholic church, come just 10 days before a tight race in elections to the European parliament.

Posted on YouTube on Saturday, the film, Tell No One, by the brothers Tomasz and Marek Sekielski has been viewed nearly 18m times. The revelations have rocked Poland’s powerful Roman Catholic church to the core.

The two-hour documentary includes hidden camera footage of victims who are now adults confronting elderly priests about the abuse they suffered decades earlier. Several of the priests admit to the abuse and apologise for it.

The film also details how priests accused, or even convicted of child sexual abuse, were transferred to other parishes and able to continue their duties and work with children.

Top Polish clerics refused to be interviewed for the documentary.

The Polish primate Wojciech Polak, who apologised “for every wound inflicted by the church’s people” after watching the film on Thursday, vowed to set up a “solidarity fund” to help provide victims with “concrete help” but insisted it was not a compensation fund.

“Where compensation is concerned, we should conform to the law in force in Poland, so if the court awards it, then the church is not above the law,” Polak told the TVN24 commercial news channel.

The Maltese archbishop Charles Scicluna, a Vatican expert on paedophilia among the priesthood, will visit Poland next month, the Polish episcopate said on Thursday.

The Polish church admitted in March that nearly 400 clergy had sexually abused children and minors over the last three decades, reflecting findings published a month earlier by a local charity.

The documentary concludes that the Polish-born pope and saint John Paul II turned a blind eye to sexual abuse when Warsaw’s communist regime was working to undermine the church, then Poland’s only independent institution.

Pope Francis last week passed a landmark new measure to oblige those who know about sexual abuse to report it to superiors, which could bring many new cases to light.