Selena Gomez dissed ex-boyfriend Justin Bieber on Instagram after he complained about trolls making hateful comments about his new girlfriend Sofia Richie.

The brouhaha erupted after Bieber threatened to make his Instagram account private if jealous trolls didn’t stop hating on galpal Sofia Richie, the daughter of legendary singer Lionel Richie.

“I’m gonna make my Instagram private if you guys don’t stop the hate,” Bieber wrote. “This is getting out of hand. If you guys are really fans you wouldn’t be so mean to people that I like.”

Justin, 22, has been in Japan with Sofia, 17, as he continues his Purpose World Tour.

Selena Gomez, 24, who dated Bieber from 2010 to 2013, snarkily replied that Justin shouldn’t post photos of his girlfriend if he can’t handle negative feedback.

“If you can’t handle the hate, then stop posting pictures of your girlfriend lol,” Gomez wrote on Instagram. “It should be special between you two only.

“Don’t be mad at your fans. They love you and supported you before any one ever did.”

Justin clapped back and implied Selena only dated him to get famous, and is now trolling him on social media for more attention.

“It’s funny to see people that used me for attention and still try to point the finger this way. Sad,” Bieber wrote. “All love.”

Then Selena shot back: “Funny how the ones that cheated multiple times, are pointing the finger at the ones that were forgiving and supportive, no wonder fans are mad. Sad. All love.”

Justin replied: “Oh, I forgot about you and Zayn [Malik]?”

It’s unclear why Selena a 24-year-old woman thinks it’s okay for Internet trolls to make hateful comments about an 18-year-old girl.

Selena didn’t like it at all when she was barraged with hateful comments (and death threats) from Bieber fans during their two-year romance. At the time, Justin also stepped in and asked fans not to hate on Gomez.

In 2014, Selena slammed Internet trolls who fat-shamed her on Instagram for gaining weight, Celebrity Health Fitness reported.

Selena, who was diagnosed with lupus in 2012, took a break from work in 2013 to get chemotherapy for the autoimmune disease.

“I was getting a lot of hate for my body and ‘You’re gaining weight,’” Gomez recounted.

While she was being fat-shamed, Selena hid out to avoid being barraged with nasty comments about her body.

“I wanted so badly to say, ‘You guys have no idea. I’m in chemotherapy. You’re *ssholes,’” Gomez wrote on Instagram. “I locked myself away until I was confident and comfortable again.”

Selena Gomez, who lost more than 10 pounds recently, said being fat-shamed inspired her new album, Revival, which she called an anthem for her renewed self-confidence.

Update: Selena apologizes for being selfish: Justin deletes Instagram account