Boris Johnson has said he is determined to tackle rising levels of knife crime by announcing an extension of police stop-and-search powers.

At the same time, the prime minister announced the government would be investing £2.5bn in creating 10,000 new prison places to ensure serious violent and sexual offenders got the sentence they deserved.

Writing in the Mail on Sunday, the prime minister said the “first duty” of any government was to protect the public.

“We have the impression of a growing culture of insolence on the part of the thugs; and in the face of that sense of impunity – entirely misplaced – I believe the British public knows instinctively what we must do,” he said.

“We need to come down hard on crime. That means coming down hard on criminals. We need to reverse the balance of fear. I want the criminals to be afraid – not the public.”

Since taking office last month, Johnson has already set out plans to recruit another 20,000 police officers over the next three years.

His latest announcement will be seen as further evidence that he is preparing the ground for an autumn general election amid continuing deadlock in parliament over Brexit.

Under the government’s plans, an existing pilot project, which allows police to deploy stop-and-search powers in an area without the authorisation of a senior officer, will be extended to cover an additional 8,000 officers in England and Wales.

Under the enhanced powers, announced by the Home Office in March, the authorisation required for a section 60 – which allows police to search anyone in an area if they anticipate serious violence – was reduced from a senior officer to inspector.

Johnson acknowledged the move would be controversial but said he believed it would have the backing of the parents of those children most at risk of getting caught up in knife crime.

“We are making clear that the police can and should make use of their stop-and-search powers,” he wrote.

“I know that left-wing criminologists will object. And, of course, it is right that stop-and-search should be done courteously and in accordance with the law. But I also know that the people who back this intervention most fervently are often the parents of the kids who are so tragically foolish as to go out on the streets equipped with a knife, endangering not only the lives of others but their own.”

Johnson said the investment in the prison system – approved by chancellor Sajid Javid – was “long overdue”.

When police did catch violent criminals, he said that it was “vital they get the sentence they deserve”.

He wrote: “In the past five years, we have seen literally hundreds of convicted rapists who have come out of prison commit another sexual offence. This cannot go on. I am afraid that as a society we have no choice but to insist on tougher sentencing laws for serious sexual and violent offenders, and for those who carry knives.”

It comes the same weekend that a traffic officer in Birmingham was seriously injured when he was run over by a suspected car thief and just days after a police officer received multiple stab wounds after being attacked with a machete in east London.