Selena Gomez credits ex-boyfriend Justin Bieber with supporting her through chemotherapy treatments for lupus.

According to Yahoo, the former Disney star confirmed Bieber often inspired her through her ordeal, telling her she was "the most beautiful girl in the world, and it wouldn't matter if she gained weight, lost her hair or anything."

Word is Bieber would also compose little tribute songs to Gomez, and whenever the two were in Los Angeles at the same time, he would come over with her favorite foods from the most exclusive restaurants in town.

"They have obviously had a lot of ups and downs in their relationship, but he really stepped up for her," a source said of the couple, who have seemingly broke up and made up more times than anyone can count. "That's not to say there haven't been plenty of other times when he was a jerk, but he knew she was struggling, and he wanted to let her know he was there for her."

Reports are Gomez feared she might lose her hair during treatments, and Bieber's kind words and acts were a big part of helping her conquer fears.

"Fortunately, she did not [lose her hair]," the source added. "And she had Justin to support her through the whole ordeal."

Gomez recently opened up about her medical struggles to Billboard magazine, saying, "I was diagnosed with lupus, and I've been through chemotherapy. That's what my break was really about. I could've had a stroke. I wanted so badly to say, 'You guys have no idea. I'm in chemotherapy. You're assholes.' I locked myself away until I was confident and comfortable again."