The BBC apologised today after US rock band Rage Against the Machine - battling with The X Factor winner Joe McElderry to be the Christmas No 1 - turned the airwaves blue on the Radio 5 Live breakfast show.

Rage Against The Machine were guests on the morning show, hosted by Nicky Campbell and Shelagh Fogarty, and invited to play a live version of their song, Killing in the Name.

The band had been asked not to sing the final refrain, "Fuck you, I won't do what you tell me!" but singer Zack de la Rocha sang it anyway.

It was not until the fourth repetition that the breakfast show production team faded out the microphone and returned to the studio.

"Get rid of it!" Fogarty could be heard shouting in the background. "Sorry, we needed to get rid of that because that suddenly turned into something we weren't expecting," she told listeners. "Well, we were expecting it and we asked them not to do it and they did it anyway."

But Fogarty enjoyed revenge – of sorts – when she told listeners: "So buy Joe's records."

It remains to be seen whether the incident will affect sales of the two records, which are said to be neck and neck in the race to be Christmas number one.

Campbell had earlier introduced the song by saying: "Let's get Christmassy!"

Fans of the band commenting on the audio on YouTube suggested Radio 5 Live should not have been surprised by their behaviour.

"This was always gonna happen!" said one. Another added: "She actually sounds surprised they didn't do what she told them to do."

"5 Live breakfast featured a live broadcast of the song Killing in the Name by Rage Against the Machine. We had spoken to the band repeatedly beforehand and they had agreed not to swear. When they did we faded the band out and apologised immediately to anyone who was offended," a spokesman for the station said.

The 5 Live Breakfast editor, Richard Jackson, defended the decision to broadcast the live performance by the rock band, despite the fact the lyrics contained numerous uses of the word "fuck".

"When Rage Against the Machine swore on Breakfast this morning, some people felt we should have seen it coming. The song Killing in the Name includes the F-word in the lyrics – and when the band accepted our request for an interview for today's programme and then agreed to perform the song live from Los Angeles, we were aware of the need to address this issue," Jackson said on the Radio 5 Live blog.

"Which is why our producer had several conversations with the band and their management about the requirement not to swear. We told them it was a breakfast show. We took them at their word when they said there would be no bad language. When it became clear on air they were including the F-words, we faded the song out and apologised.

"Not before we heard some swearing on air. We're sorry for that and I apologise again to anyone who was offended."

Jackson said the response from listeners had been mixed. "A minority were angry or offended. Some thought we had been naïve. A fair number reckoned the song was awful. But many people said they find these live, unplanned, unpredictable moments the highlight of their listening – and they were quick to tell us so."

It was the second four-letter incident on a BBC national radio network in two days after singer George Michael swore on Chris Evans's BBC Radio 2 drivetime show.

Asked if he would ever appear on Top Gear, Michael said: "Other than the fact I'd be afraid of coming last on that fucking scoreboard."

Evans told Michael he could not swear on the show and the singer later said he "sincerely apologised". At the end of the show Evans added: "Once again we apologise for some colourful language."

• To contact the MediaGuardian news desk email editor@mediatheguardian.com or phone 020 3353 3857. For all other inquiries please call the main Guardian switchboard on 020 3353 2000.

• If you are writing a comment for publication, please mark clearly "for publication".