The pop star revealed in February she was leaving the singing competition after seven seasons.

From left: Lionel Richie, Katy Perry, host Ryan Seacrest and Luke Bryan on Sunday night's finale of 'American Idol.'

From left: Lionel Richie, Katy Perry, host Ryan Seacrest and Luke Bryan on Sunday night’s finale of ‘American Idol.’ DISNEY/ERIC MCCANDLESS

Katy Perry said goodbye to American Idol after seven seasons on Sunday night’s live finale.

As a tribute to the singer, the ladies of the top 12 performed a medley of Perry’s hits, including “Teenage Dream,” “Dark Horse” and “California Gurls.”

Perry, who was eating a slice of pizza when the performance began, jumped onto the judges’ table at the end of the performance and gave a strong-arms salute.

Perry also performed “What Makes a Woman” alongside competitor Jack Blocker during the three-hour finale.

Meanwhile, Abi Carter was named the winner of Season 22 on Sunday night. She performed “What Was I Made For?” from the Barbie movie, during which Perry could be seen getting emotional.

Perry announced in February that she would be leaving the ABC singing competition.

Appearing on an episode of Jimmy Kimmel Live!, Perry was asked by host Jimmy Kimmel directly how long she was likely to continue with Idol.

“Well, you know, this fall, this September, I’m going to be doing this huge music festival in Brazil called Rock in Rio. It’s really exciting. It’s a big deal for people all over the world, especially my Brazilian fans,” Perry said, adding, “So I think this will probably be my last season for Idol.”

Katy Perry Makes 'American Idol' Exit in Her Emotional Last  Episode | whas11.com

Following a few gasps from the audience, Perry continued: “I love Idol so much. It’s connected me with the heart of America. But I need to feel that pulse of my own beat.”

She hadn’t shared the news with fellow judges Luke Bryan and Lionel Richie at the time of her announcement, but Bryan later said he had heard “whispers that she was thinking about it. It wasn’t like a huge shock.”

For his part, Richie said when he heard the news, “it just made me run off the road … . My phone blew up.” Buyt he added that her decision “makes sense.”

Perry had been a judge on American Idol alongside Richie and Bryan since the show was revived by ABC in 2018.