Madonna was a radical, brilliant pop icon who changed so many people’s lives. Mine included. I grew up in Bolton in the 1980s, at a time when no one wanted to say anything positive about gay people. If we were represented in the media, it was as disease-carrying sexual predators who couldn’t be trusted around children. The idea of gay role models didn’t even exist. And then along came Madonna.

I first became aware of her around the time Like a Virgin was released in 1984, and felt myself being drawn in, but I resisted. I’d been conditioned to be mistrustful of transgressive, rebellious women who expressed their sexuality. By the time the True Blue album came out in 1986 – I was 11 – I was starting to realise I was gay. And that made me sexually transgressive too.

Then came the Open Your Heart video. In it, Madonna played a stripper dancing in a venue for an audience that included a lesbian drag king and two gay sailors locked in an affectionate embrace. The thing about her that had been my point of contention suddenly became a point of connection. After that, I didn’t just enjoy Madonna’s work: she became like a spirit guide.

People forget the role Madonna played in opening up gay culture to the mainstream. She wasn’t gay herself, but from the beginning she talked about how gay people were part of her life: her gay mentor, her dance teacher, Christopher Flynn; the artists and photographers she hung around with like Keith Haring and Herb Ritts; the gay dancers she paraded around so proudly in the film In Bed With Madonna. You cannot imagine what it was like to witness her doing that when you were being mercilessly bullied about your sexuality at school, as I was. This was when George Michael, Freddie Mercury and the Pet Shop Boys didn’t dare to come out.

Nowadays, online, it’s easy to know that there are other people like you in the world. But in the 1980s, you existed in your own bubble. This was also the time of Aids emerging. The album Like a Prayer came with a copy of a handwritten note from Madonna – I remember so clearly opening it, and how tenderly it was worded, declaring that everyone with Aids deserved respect and compassion, “regardless of their sexual orientation”. Madonna was accused in TV interviews at the time of being irresponsible because of her support for gay culture – you can still see clips of this on YouTube. But she ripped into homophobic interviewers with such ferocity, like a lioness protecting her cubs. It had an incredible impact on me.

Before Madonna, it felt like all gay icons had been tragic figures. And yes, Madonna had endured great tragedy in her life – her mother died when she was five – but you never saw an ounce of fragility in her. Think of her in that Jean Paul Gaultier basque – it was like a suit of armour. She was all steely defiance and I wanted to channel this to get through the challenges life was throwing at me.

Facebook Twitter Pinterest A young Matt Cain in his bedroom, complete with Madonna posters.

I started to write a novel about growing up gay back in 2006, but it didn’t start working as an idea until I added Madonna. I travelled to Argentina, working as a producer on The South Bank Show. I was recognising so many locations from Evita and couldn’t get the film’s soundtrack out of my head. It dawned on me that Madonna had been with me all my life. There’s a lot that’s different to my own life in my novel, but a chapter about the protagonist, Charlie, going to see Madonna in her first ever UK concert in Leeds in 1987 is one of the most autobiographical. I remember watching in awe as my idol performed a show that was all about self-respect and standing up for your self. I was blown away

Since I started talking publicly about the book I cannot tell you how many messages I’ve had from people saying that they recognise the story, and the place of Madonna in it. When it came to selling the film rights for my book [they were sold recently for a six-figure sum], I was told we could not negotiate a deal until we secured Madonna’s approval. I was so nervous. But her office came back and said yes. The younger me – and the older me – was elated.

When people think about 1980s pop icons, they often think of those who’ve gone: Prince, Whitney, Michael Jackson. They often forget about Madonna, the only one that’s survived – and they continue to mock her, not just for being a sexually confident woman but for one who’s dared to get older and continue to produce work.

But I love how Madonna’s never wanted to be seen as a nostalgia artist and how in recent years she’s become even more politically outspoken. Her speech at the Billboard women in music awards in 2016; she called out the “blatant sexism and misogyny and constant bullying and relentless abuse” she’d experienced as a woman in the music industry. So many people have relied on Madonna’s music for emotional support in their lives and I’m so glad she’s still here, still expressing herself, absolutely on her own terms. Because if she hadn’t been doing that when I was younger, I’m not sure I’d be here now – and I certainly wouldn’t be the person I am today.

@mattcainwriter

The Madonna of Bolton by Matt Cain is out now (Unbound £14.99). To order a copy for £12.74 go to bookshop.theguardian.com or call 0330 333 6846 Free UK p&p over £10, online orders only. Phone orders min p&p of £1.99

• Dancer Carlton Wilborn on Madonna: ‘Rehearsal truly was like boot camp’