Radio 4 show Don't Make Me Laugh has been found to have breached the broadcasting code after airing jokes about the Queen's sex life on her 90th birthday.
A pre-recorded episode was broadcast on the monarch's birthday at 6.30pm on April 21, and included the subject "The Queen must have had sex at least four times".
The comedy panel show, hosted by David Baddiel, was aired despite being "placed on the Radio Risk List and Managed Risk Programme List" because of its time slot and because the series contained some potentially offensive material.
Comedians Russell Kane, Sara Pascoe, Omid Djalili and Adam Hess also featured on the show.
The BBC said that Radio 4 and the production company which made this programme had discussed "editorial standards" at "an early stage in the production process".
But watchdog Ofcom said "the only issue raised concerning this particular episode was to seek permission to bleep some strong language".
"The BBC's editor for editorial standards had listened to 'a rough-cut of the programme during the production process' and considered that the segment about the Queen 'did not raise any issues in terms of editorial standards and did not consider that this particular sequence needed amending'," Ofcom said.
But it was not known at this point that the episode would be aired on the Queen's birthday.
The BBC said the production company later filled in a compliance form, which asked if the programme included "potentially controversial references to public figures".
The production company did not point out that the programme included references to the Queen, despite the date of transmission then being known.
The BBC said that if the compliance form had "contained information alerting the station to the reference to the Queen", the content "would have been listened to (again) because of the proximity to the (Queen's) 90th birthday celebrations".
Ofcom found the programme in breach and concluded that "it is likely that Radio 4 listeners would not have expected comedic content about the Queen of this strength and directness to be included in a Radio 4 comedy programme broadcast in the early evening on her 90th birthday".
The BBC, which has since axed the series, said it had apologised to Buckingham Palace.
It had also apologised on its corrections and clarification page.
The BBC Trust, the corporation's regulatory body, ruled earlier this year that the jokes on the show breached the broadcaster's editorial guidelines.