Sinéad O’Connor’s “The Magdalene Song” will feature in the final episode of BBC's “The Woman in the Wall," a fictional drama that looks at Ireland's inhumane Magdalene Laundries, tonight, Monday, September 25.

O'Connor gave the makers of the show permission to use her song before her death, which was confirmed by her family on July 26.

“The first half of the track is completely heartbreaking, and the second half is pure defiance," David Holmes, the Belfast musician who produced O'Connor's music in her final years and had been composing music for the BBC drama, told The Observer.

“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.”

O'Connor had firsthand experience in a Magdalene Laundry, specifically An Grianán training centre, which was attached to St. Mary’s High Park Convent’s Magdalene laundry in Drumcondra, Dublin. The institution, which O'Connor attended in the early 1980s, only closed in 1996.

In a 2013 open letter, penned just after the Irish government published a report on the State's involvement with the Magdalen Laundries, O'Connor recounted witnessing a newborn being taken away from his mother against her wishes while in the institution. 

In a subsequent interview with the Irish Sun, O'Connor described the institution, where she spent her third and fourth years of secondary school, as a "prison."

She added: “I wouldn’t class myself as being abused while I was there. I came in at the tail end of it.

“But certainly some of the punishments were a little f***ing odd.

“As a punishment, I would be sent up to bed early to go to sleep with the dying old Magdalene ladies. There would be about six of them in the room and me and I was terrified. These women were old and dying and I was scared up there.

“The laundries were gone then, but I did see them in a big room, about 200 square feet full of laundries. And I saw the older women, shuffling along. We were not allowed to talk to them.”

Holmes said he contacted O'Connor after Susan Breen, producer of "The Woman in the Wall," told him she was a fan of the Irish singer-songwriter.

“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," Holmes told The Observer.

"Sinéad said: ‘I believe you. Give them 'The Magdalene Song.’”

Offering his own interpretation of O'Connor's song, Holmes said: “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.

“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 said the producers were "amazed to have something so strong" and that they all felt "the only place this can go is at the end."

The final episode of “The Woman in the Wall,” which BBC describes as a “fictional drama series which examines the legacy of one of Ireland’s most shocking scandals – the inhumane institutions known as The Magdalene Laundries,” airs tonight, September 25 in the UK.

The series, which stars Irish actor Daryl McCormack and Ruth Wilson, airs on BBC One and iPlayer in the UK and on Showtime in the US and will be distributed by Paramount Global Content Distribution in all other territories.