Katy Perry has thanked first responders after she was helped by firefighters when she collapsed due to a gas leak on the set of American Idol.

The singer fell to the ground after she, her fellow judges Lionel Richie and Luke Bryan and contestants taking part in the auditions for the show were removed from the studio.

Perry had complained that she could “smell gas” before adding that it was “pretty intense”, and that it was giving her a headache as the judges sat at the desk.

Bryan told the show’s producers: “We’re getting heavy propane.”

Following the on-set drama, which aired in Sunday’s episode of the programme in the US, Perry tweeted: “Big shout out to all of our first responders around the country – thanks for risking your lives every day… and all night long.”

She posted a clip of herself hugging one of the men who had helped and returning to the audition room, where three of the firefighters were joined in a singalong of All Night Long by Richie, Perry and Bryan.

On Instagram, the Roar singer posted clips and pictures of herself being looked after when she dropped to the ground.

In the caption, she joked: “Me alerting the group chat about drama in real-time.”

She also tweeted: “FIRST OF ALL, do you know how many texts I got from my mom and dad about the texts they got asking if I was okay #gasleak #AmericanIdol.

“SECOND OF ALL, I’m used to smelling gas at the desk but it’s usually @lukebryanonlineDash #AmericanIdol.”

A clip shared on the competition programme’s official Twitter showed one of the firefighters saying that the “building is safe to enter now” after they had fixed an issue with the gas in the kitchen area of the building the show was being filmed in.

Another said that it was “a pretty big deal” to save Perry’s life.