The UK’s most senior police officer has criticised Boris Johnson for making a political speech in front of a backdrop of police recruits and expressed puzzlement at how it was allowed to take place.

The Metropolitan police commissioner, Cressida Dick, was away earlier this month when the prime minister was accused of abusing the impartiality of the police by making partisan comments about Brexit and the next election at a police training college in Wakefield.

Asked about the incident on an LBC radio phone-in on Tuesday, Dick joined the West Yorkshire chief constable, John Robins, in questioning the prime minister’s behaviour.

She said: “To make a highly political speech in front of a group of police officers does seem to me to be problematic on all sides.” She added: “How it happened, I don’t know. But I’m sure everybody wishes it hadn’t happened.”

Dick pointed out that the chancellor, Sajid Javid, had visited a police training college in Hendon, north-west London, after announcing the recruitment of 20,000 police officers to replace those cut since 2010.

She added: “I’m glad to say nothing like that happened at Hendon.”

Dick also promised to “learn the lessons” from Met failures during the multimillion-pound Operation Midland inquiry into allegations of a VIP paedophile ring based on the fabricated claims of Carl Beech.

Dick was involved briefly at the start of the operation in 2014 before leaving the force for a stint at the Foreign Office.

Just after she left, a senior officer in charge of Operation Midland, Det Supt Kenny McDonald, described Beech’s claims about historic child abuse by prominent members of the establishment as “credible and true”.

She said: “Everybody thinks that that was just a mistake. It shouldn’t have been said.

“When I heard I was very surprised. And I just felt for him immediately. I remember thinking: ‘Oh no, I know you didn’t mean to say that.’ What he would have meant to say was this person appears credible. And unfortunately when pressed he said ‘credible and true’. And that of course was a mistake. It was unfortunate and it dented people’s confidence in the investigation from there on in.”

Dick added: “I was not in policing for the vast majority of the time that Midland took place. My job is to make sure that the Met has learned lessons and we look forward.”

She added: “It was horrific in its impact on the individuals. I think it has damaged the Met’s reputation.”