Jokes about the Queen's sex life made on Radio 4 breached the BBC's editorial guidelines, the corporation's regulatory body has said.
The BBC Trust was commenting on jokes made during comedy panel programme Don't Make Me Laugh.
The show is presented by David Baddiel and the pre-recorded episode in question was broadcast on the Queen's 90th birthday at 6.30pm.
The trust noted that the episode included the subject "The Queen must have had sex at least four times".
The premise of the programme is that comedians must try not to make the audience laugh as they discuss a particular subject, which then rotates between contestants.
The BBC Trust said: "Trustees considered that this output included personal, intrusive and derogatory comments which had exceeded the expectations of the audience. The offence felt was compounded by the date of the programme's transmission.
"Panellists made comments about the Queen and the Duke of Edinburgh in a way that was personal, intrusive and demeaning," an official summary noted.
The BBC acknowledged it had received complaints from listeners following the programme and issued a formal apology on its Corrections and Clarifications section.
"While BBC Radio 4 comedy is a broad church and often pushes boundaries, we would like to apologise for this broadcast of Don't Make Me Laugh," a statement at the time said.
"We never intended for the scheduling of the programme to coincide with The Queen's birthday and are sorry for the offence caused by its timing and content."
The panel of comedians featured on the episode in question were Omid Djalili, Sara Pascoe, Russell Kane and Adam Hess.
The BBC informed the Palace of its apology and also removed the programme from its iPlayer. It also did not repeat the transmission and moved the remainder of the series to a later time slot of 11pm.