What began as an “American Idol” contestant’s medical emergency turned into an emotional performance that brought judge Katy Perry to tears.

During Monday’s episode of the reality singing competition, 17-year-old contestant Makayla Brownlee took the stage to sing a cover of Kacey Musgraves’ “Rainbow” when it quickly became apparent that something was wrong. The Wellington, Kansas, woman’s speech seemed to be labored while she was introducing the song. When it came time for her to sing, she abruptly turned and struggled to walk off the stage.

The contestant collapsed just offstage, where crew members and EMTs quickly tended to her. Perry urged her fellow judges, Luke Bryan and Lionel Richie, to give Brownlee some space, but the duo couldn’t resist checking up on the youngster. As it turns out, Brownlee was having a seizure, but it was nothing she hadn’t experienced before.

“In seventh grade, I was diagnosed with vasovagal syncope,” Brownlee explained after the incident. “It’s a heart condition that causes me to react to stress differently than other people, and it could cause a seizure.”

Katy Perry was moved to tears after an 'American Idol' contestant suffered a seizure on-stage only to return hours later.

Katy Perry was moved to tears after an ‘American Idol’ contestant suffered a seizure on-stage only to return hours later. (ABC/Eric McCandless)

“She can’t control it. She’s embarrassed, but physically, she’s 100 percent all right,” the singer’s father told the cameras. “This opportunity is so important for her. I’d hate to see it inhibited in any way because she’s such a good singer. She works so hard at it.”

Clearly moved by the incident, Perry took to Twitter during the broadcast to share some words of encouragement with Brownlee.

“Nothing to be embarrassed about, #MakaylaBrownlee. We all handle stress differently❣️ #AmericanIdol,” the “Firework” singer wrote.

Hours after collapsing, Brownlee returned to the stage for another try, delivering a performance that brought Perry to tears and earned her a spot in the competition’s Top 40.

“The stress this week has definitely been a lot harder on me than anything I’ve ever gone through,” Brownlee explained after her successful performance. “There’s nothing I can do to prevent a seizure. When I’m stressed out, my body just reacts differently.”

Perry took to Twitter once again to share her appreciation for Brownlee, writing: “That was the sweetest performance of ‘Rainbow’ #MakalylaBrownlee. So thrilled you were able to come back and sing for us and give us that perspective we need to be reminded of sometimes ♥️ #AmericanIdol @KaceyMusgraves.”

This has been a particularly stressful week for “American Idol” all around as Fox News learned that production on the current season is “currently suspended” amid the ongoing coronavirus pandemic.

Episodes will continue to air as scheduled as the show draws closer to its live episodes, which are set to begin in April. Production “will examine things on a week to week basis,” Fox News learned at the time.

Fox News’ Nate Day contributed to this report.

Fox News