Unreleased Sinéad O’Connor song to play at finale of church cruelty drama

Hers was once the lone voice of protest singing out against the abuses of the Catholic church in Ireland – a brave stand that made her an outcast in the entertainment industry until many of her claims were proved true.

Now, just a few months after her death, and in a powerful testament to her legacy, Sinéad O’Connor will be heard singing The Magdalene Song – a tune she gave to the makers of the TV drama The Woman in the Wall – at the close of tonight’s final episode.

Related: Ireland apologises for 'slave labour' at Magdalene Laundries

In an emotional secret finale, O’Connor’s solo vocal traces the pain of a mother who has lost a child, before, in a final orchestrated flourish, it celebrates a determination to survive.

“The first half of the track is completely heartbreaking, and the second half is pure defiance,” said David Holmes, the Belfast musician who produced O’Connor’s music in her final years. “I stripped the song away to just Sinéad’s voice and then let the full power come in for the second half. It’s incredible how the meaning of the song came together with this story It was just meant to be. There’s a certain magic when you bring music to an emotive story.”

Ruth Wilson stars in the unsettling BBC drama, which details the impact of the cruel regimes prevalent in Ireland’s Catholic church-run homes for unmarried pregnant girls and women. Now referred to as the Magdalene laundries, the institutions were run by nuns, and many operated like religious labour camps.

“Sinéad sanctioned the track for use before they had even started shooting, and when the producers heard it they were amazed to have something so strong. We all felt the only place this can go is at the end,” said Holmes.

O’Connor, who was found dead in July aged 56, had been sent to a similar institution when she was caught shoplifting at age 15. She later spoke of the sympathy she felt for other women who had been damaged by the secret oppressions of the church.

“In the lyrics Sinéad was trying to say, I think, that though she’d been through great turmoil, it would not stop her being who she wanted to be,” said Holmes. “She never really spoke about the meaning of her songs. She used to joke that she would often tell people that her songs were about something completely different to what they were about. But this one – well, it’s called The Magdalene Song.”

Holmes had been finalising work on O’Connor’s 11th, and so far unreleased, album in the months that led up to her death, as well as composing for the drama series. When the show’s producer, Susan Breen, told him she was an O’Connor fan, Holmes called the singer to explain the series. “I told Sinéad the script was not like anything else anyone has done on the subject, and it had Ruth Wilson, one of the finest actors in the world – on a different level. Sinéad said: ‘I believe you. Give them The Magdalene Song.’”

A decade ago, O’Connor wrote a public letter about her teenage experience in response to the findings of the McAleese report on the Magdalene laundries. While she had been treated well by a nun who had bought her a guitar, she said she had also witnessed cruelty to a young pregnant girl. “One morning I woke to hear my friend screaming. And I ran out of my cubicle I saw her surrounded by two or three nuns. I can’t quite remember how many. They tore my friend’s baby from her arms,” O’Connor wrote.

Holmes said the drama’s central character, Lorna, played by Wilson and described by the Observer’s TV critic as “trauma incarnate”, reminds him of O’Connor. “My big regret is that Sinéad’s not here to see the series,” he said. “She would have been proud. Some people have criticised the black humour in the script, but growing up in Belfast I’ve seen the dark humour that people use to get through.

“It’s crazy that the last laundry only closed in the 90s. Those girls were being tortured. I’ve never been able to get my head around the collective evil of those nuns.”

O’Connor’s family will decide whether to posthumously release the singer’s first album for eight years, No Veteran Dies Alone. Its title was inspired by charity work O’Connor did three years ago with elderly soldiers in America.

Holmes had worked on the album with O’Connor on and off since 2018. “Sometimes she would just send a song over to me with a vocal recorded on a karaoke machine, but they were still amazing,” he said.

In January 2022 O’Connor announced the death of her 17-year-old son, Shane. She is survived by her children Jake, Roisin and Yeshua.