Miley Cyrus opened up recently about her collaboration with Beyoncé on Cowboy Carter and what sparked the song they worked on together.

Variety reported that the Flowers singer talked with W Magazine about how she became part of II Most Wanted and was the writer for the popular track that was in the works for a while now.

Miley Cyrus discusses collab with Beyoncé for II Most Wanted

“I wrote that song, like, two and a half years ago,” Cyrus said of the song. “My mom would always go, ‘I love that song so much.' So when Beyoncé reached out to me about music, I thought of it right away because it really encompasses our relationship.”

“I told her, ‘We don't have to get country; we are country. We've been country,'” she added. “I said, ‘You know, between you being from Texas and me being from Tennessee, so much of us is going to be in this song.' Getting to write a song, not just sing, for Beyoncé was a dream come true.”

The two of them first were around each other in 2008 during a charity performance, which sparked them to get to know each other and ultimately collaborate. During the show, Cyrus was “sandwiched” between Beyoncé and Rihanna.

“Their hips were, like, up to my shoulders,” the ex-Hannah Montana star said. “They were these powerful, fully realized, grown women, and I'm pretty sure I had braces on the back of my teeth. They were protective of me.”

Cyrus continued, “That Christmas, Beyoncé sent me a House of Deréon jacket that said Miley on the back in gold studs, which is my favorite, and some jeans with my name on it. In one of my songs, Cattitude, I say, ‘And for my 16th birthday, I got Deréon from the house of the queen.'”

Additionally, in the interview, Miley also got honest about the Grammys and how she wasn't taken too seriously before the success of Flowers.

“No shade, but I've been doing this for 2o years, and this is my first time actually being taken seriously at the Grammys?” the singer said. “I've had a hard time figuring out what the measurement is there, because if we want to talk stats and numbers, then where the f–k was I? And if you want to talk, like, impact on culture, then where the f–k was I? This is not about arrogance. I am proud of myself.”

Regarding Flowers, Cyrus performed it at this year's Grammys ceremony. She stated that she wanted it “to be a celebration of bravery because I perform out of fear.”

The singer continued, “I didn't always have the fear of performing that I have now. But going from spending two years alone and seeing no more than one person a day during lockdown to knowing that millions of people watch the Grammys is a big shock to the nervous system. Anyone who's ever put themselves in a position to be observed or judged is brave. It doesn't matter if it's eight or 8 million people — that fear is there. Before I went onstage, right as that curtain was about to lift, I was screaming at the top of my lungs, ‘I am free!'”

Check out Miley Cyrus and Beyoncé in Cowboy Carter, which is available to stream or purchase.