Selena Gomez Suffered a Panic Attack Before AMAs Performance: 'It Threw Her Off' Says Source

Selena Gomez is taking heat following a shaky performance at the AMAs, and now a source close to the singer tells PEOPLE she suffered a panic attack right before hitting the stage.

“She definitely had a panic attack. She was nervous. She hasn’t been on stage in two years, and it’s an important song in her career,” says the source. “She really wanted to deliver.”

For her first live television performance in two years, Gomez, 27, performed her two new songs, the vulnerable ballad “Lose You to Love Me” and upbeat anthem “Look at Her Now.”

Gomez’s panic attack hit “at the last minute,” says the source. “It threw her off. She did sound better at rehearsal.”

Selena Gomez | JC Olivera/Getty Images
Selena Gomez | JC Olivera/Getty Images

RELATED: Selena Gomez Says It ‘Feels Good to Be Back’ as She Opens the 2019 AMAs Performing New Songs

Though the performance wasn’t her best, the star still enjoyed the night as she danced and sang along in the audience.

“She had fun afterwards with her friends and family and was in good spirits,” says the source.

Check out PEOPLE’s full AMAs coverage to get the latest news on one of music’s biggest nights.

Later in the night, Gomez expressed her gratitude on social media. “Feels good to be back,” she wrote on Instagram with photos of her red carpet look. “Thank you to my entire team and to my fans that stand by me. All of this is for you and because of you. excited for this chapter.”

Selena Gomez | Steve Granitz/WireImage
Selena Gomez | Steve Granitz/WireImage

Gomez previously performed at the AMAs in 2014, 2015 and 2017, when she sang her song “Wolves.”

It’s been more than two years since Gomez, who suffers from lupus, revealed she’d undergone kidney transplant surgery, sharing that her best friend Francia Raisa had given her the organ as a life-saving measure. The star has taken time off to focus on her health but came roaring back to the music scene again this year.

Fans had been clamoring for years for new music from Gomez, who hasn’t released a solo album since 2015’s Revival.

Earlier this month, “Lose You to Love Me” became Gomez’s first No. 1 on the Billboard Hot 100 Chart after racking up 38.8 million streams in the U.S. in its first week of release.

“My first number 1!! This song is so dear to my heart. I’ve been working so hard to make this album as honest and fun as possible while remaining vulnerable enough to share where I am in life,” Gomez wrote on Instagram in celebration.

“I love you deeply and thank you so much for listening,” she continued. “I want to thank each and every person that was [a part] of this moment that I’ll never forget!”

E! News was first to report the news.