Normally, Linda Perry doesn't write songs for movies. A member of the '90s rock band 4 Non Blondes who has written hits for pop stars like Pink and Christina Aguilera, Perry says she’s too sensitive to deal with the feedback from studio executives and producers. “Everybody has an opinion, don’t they?” she says. “It never works out for me."
But for “Hands of Love,” a new song performed by Miley Cyrus that Perry wrote for the upcoming movie Freeheld, it just happened. Not just because the song's eventual co-producer, Kerry Brown, who is married to one of the film's producers, wouldn't take no for an answer—but because, to hear Perry tell it, the song came to her with unprecedented ease.
Freeheld stars Ellen Page and Julianne Moore as Stacie Andree and Laurel Hester, a real-life lesbian couple who fought New Jersey county officials to allow Hester (Moore), a police officer diagnosed with terminal cancer, to transfer her pension benefits to Andree (Page). Perry says she was “completely moved” by the film and started writing a song on the spot in her car immediately after the screening . “I’ve never had this happen before,” Perry says of the track, which you can hear for the first time in a new trailer premiering exclusively at TIME Monday. “The arrangement is there, the lyrics are showing up, I can’t get to a piano, there’s no instruments, there’s no nothing—it’s all just floating around inside my head."
Ron Galella, Ltd.—WireImage/Getty Images
(Read next: Ellen Page on 'Freeheld' and Why She Came Out)
When it came time to find a vocalist for the song, which plays over the end credits of the film, it was Page who suggested Cyrus. Earlier this year, Cyrus launched the Happie Hippie foundation, an organization serving homeless and LGBTQ youth that Cyrus calls the “thing that I’m most proud of in my life.”
"She has a really raw, unique, awesome, beautiful voice, and Miley's doing a lot of incredible things for the LGBTQ community," Page says. "I just thought it was going to be a perfect fit. She and Linda made something really special. I kept listening to it after I heard it.”
For Cyrus, the song presented an opportunity to support two of her favorite actresses. "I think Ellen Page is super amazing and brave,” Cyrus says. "And Julianne Moore, I told her drunkenly one night at an afterparty—I like film, but I've never been a fan of somebody in film or had favorite movies, but all my favorite movies that I do have, she is in. She picks amazing roles."
“Hands of Love” also allowed the 22-year-old to combine her passions for LGBT equality and music. "People like to learn through entertainment," Cyrus says. "It’s an interactive way to get people to hear your message by putting it in a song they like to listen to, or a film they want to see.”
Recording the track was a change of pace for Cyrus, who released her latest album, Miley Cyrus & Her Dead Petz, for free at the conclusion of this year's MTV Video Music Awards. That album of experimental stoner-pop was recorded during many late nights in Cyrus' makeshift garage studio. "I recorded half those songs at like 3 a.m about my truth, or right after having a sh---y conversation with someone I love," Cyrus says. "I would literally be on the phone crying and go straight into the booth and just work at my house.” For "Hands of Love," she had to step into Perry's world—a real studio during daylight hours.
The pair worked well together, Perry says. “She walked in with no entourage, no fuss, no anything. She came to be of service for the song and the movie and didn’t bring ‘Miley’ with her.” Cyrus recorded just a few takes of the song, which is largely unchanged from the version Perry wrote in her car.
“I wish I could take credit for this song, but honestly, I can’t," Perry says. "Freeheld basically wrote this song. It was so inspired by the story. The movie wrote the song. Everybody wrote the song. Anybody involved in it wrote this song. I know that's cheesy, but it's the truth."