Selena Gomez and Julia Michaels connected over their ‘sh—ty’ exes while songwriting

Selena Gomez and her longtime songwriting partner Julia Michaels have done some of their best work while reeling over the ex-men in their life who have broken their hearts.

The 26-year-old Michaels discussed her storied professional relationship with Gomez, 27, on Friday as the California singer-songwriter has helped the former Disney standout construct some of her most successful hits, including Gomez’s recent smash “Love You to Lose Me.”

“When [Gomez and I] first started working together [in 2013], it started as me writing the songs,” Michaels told Variety.

She continued: “I walked in to the session one day because she wanted to change some words to the song, and [Gomez] was like, ‘We must be going through the exact same thing because you’re writing everything that I feel.’ And I was like, ‘Oh, cool, you had a s---ty ex-boyfriend too? Let’s go!'”

SELENA GOMEZ REVEALS THIGH TATTOO AFTER AMERICAN MUSIC AWARDS PERFORMANCE

In describing her writing process, Michaels said she takes a literal approach to the art, adding that her biggest inspirations come from the conversations she has with loved ones and with herself.

“That helps me figure out what I want to say lyrically,” she told the outlet. “I write everything as if you’re talking to the person you’ve wanted to confront; if you could say it to somebody, why couldn’t you say it exactly how you would in a song?”

HAILEY BALDWIN SLAMS 'FALSE DRAMA' AFTER SELENA GOMEZ FEUD RUMORS: 'THIS HAS TO STOP'

When Gomez premiered “Lose You to Love Me” in late October, fans immediately speculated that the telling record was inspired by her highly-publicized relationship to ex-boyfriend Justin Bieber, 25, whom the “Wolves” performer began dating in late 2011 before ending their long-running on-again-off-again relationship for good in March 2018.

Justin Bieber and Selena Gomez attend The 2011 ESPY Awards at Nokia Theatre L.A. Live on July 13, 2011 in Los Angeles, California. (Photo by Christopher Polk/Getty Images for ESPN)

Justin Bieber and Selena Gomez attend The 2011 ESPY Awards at Nokia Theatre L.A. Live on July 13, 2011 in Los Angeles, California. (Photo by Christopher Polk/Getty Images for ESPN) (2011 Getty Images)

Bieber has since married model and “Drop the Mic” host Hailey Baldwin.

Following the release of Gomez's latest single, the singer took to Instagram to thank fans for their support.

CLICK HERE TO GET THE FOX NEWS APP

“Thank you all for standing by my side through the highs and lows,” the singer wrote, referencing her publicized mental health struggles.

“I couldn’t do it without you all and I can’t wait to start my next adventure with you,” she added.