David Cameron was filmed telling the Queen that Nigeria and Afghanistan were "possibly the two most corrupt countries in the world".
The PM singled them out as the worst offenders among the "fantastically corrupt" countries being represented at a summit against global graft he has convened in London this week.
He was caught on a broadcast camera making the comments as he chatted with the Queen, the Archbishop of Canterbury and Commons Speaker John Bercow at a Buckingham Palace event to mark the monarch's 90th birthday.
Downing Street downplayed the significance of the remarks - pointing out that the leaders of both countries had acknowledged the scale of the problem they faced.
Afghanistan's Ashraf Ghani and Nigeria's Muhammadu Buhari have written essays for a book accompanying the summit.
Ghani, No 10 said, acknowledges in his piece that Afghanistan is "one of the most corrupt countries on earth" and Buhari that corruption became a "way of life" in his country under "supposedly accountable democratic governments".
But Labour likened the episode to a previous gaffe - when Cameron was caught revealing how the Queen "purred" with pleasure when he told her Scots had rejected independence.
"This is another gaffe from the PM - you'd hope he'd have learned his lesson when it comes to off the record comments and the Queen but sadly not," MP Wes Streeting said.
"The fact that David Cameron has egg on his face shouldn't deflect from the more serious issue: for all his talk about corruption he's failing to act.
"If the PM really is serious about tackling corruption at the summit this week he needs to get his own house in order and make good on his promise to deliver public registers of beneficial ownership for the UK Crown dependencies and overseas territories."
Cameron - who is seen standing next to Commons Leader Chris Grayling in the group - said that the summit had been discussed at a "very successful" Cabinet meeting earlier.
The archbishop - the Most Rev Justin Welby - is heard to intervene to make clear that "this particular president" is not himself corrupt.
Bercow is also heard making a joke about the summit, quipping: "They are coming at their own expense, one assumes?"
After some laughter, Cameron answers: "Yes ... because it's an anti-corruption summit, everything has to be open, so there are no sort of closed-door sessions, it's all in front of the press.
"It's going to be ... it could be quite interesting. But anyway..."
The exchanges at the palace began with Cameron joking about him and Grayling being on rival camps in the debate over Britain's EU membership.
"So here we have the great axis of the Prime Minister and the Leader of the House," Bercow is heard to say of the pair.
The PM shot back: "I don't know about that. Well, we're on the same side most of the time."
Asked whether Cameron regretted his comment, a Downing Street spokesman said: "Both leaders have been invited to the summit because they are driving the fight against corruption in their countries. The UK stands shoulder to shoulder with them as they do so."
The spokesman declined to say whether the Nigerian or Afghan governments had contacted Downing Street following the Prime Minister's remarks.
He made clear that the PM was aware that he was being filmed at the time he spoke, telling reporters: "The cameras were very close to him. There were multiple cameras in the room."
The director of policy at development charity ActionAid, Alison Holder, said: "We desperately need action to stop tax havens fuelling tax dodging and corruption.
"Nigeria has signed up to new rules to publicly reveal who owns shell companies. David Cameron has a fantastic opportunity to demand the same transparency from British overseas tax havens at this Thursday's anti-corruption summit."
Anti-corruption movement Transparency International ranked Afghanistan as 166th and Nigeria 136th out of 168 countries and territories in its Corruption Perceptions Index for 2015.