David Cameron today attacked the government over the crisis in Britain’s prisons, declaring that whoever was in charge, the country “isn’t safe under Labour”.

In another boisterous session of prime minister’s questions, the Conservative leader said the bursting prison population, and news yesterday of the shortage of youth custody places, was caused by a “complete failure of planning” by ministers.

Mr Cameron noted that in May, chancellor Gordon Brown was put in charge of public protection, and declared: “Isn’t the truth that it doesn’t matter who is in charge – Brown and Blair, Blair and Brown – this country isn’t safe under Labour?”

Tony Blair rejected his criticisms, citing a National Audit Office (NAO) report that showed the youth justice system had been “substantially transformed” since 1997 and highlighting plans to build a further 8,000 adult prison places.

“He’s unable to do that because of his tax cut policy,” the prime minister said, referring to the Tories’ tax reform commission which last week recommended £21 billion of tax cuts.

Mr Cameron hit back, saying: “If he wants to talk about cuts, why doesn’t he talk about 20,000 jobs cut in the NHS?” But Mr Blair immediately rejected this figure, saying there were an extra 300,000 people working in the NHS than when the Tories were in power.

“This party is committed to increasing investment in the NHS, and he is not,” the prime minister said.

When the Tory leader returned to the dispatch box for his second set of questions, he focused on the climate change bill, which his party has been championing and which the government is expected to introduce in the Queen’s speech next month.

Mr Cameron noted that Mr Blair had dismissed plans for such a bill in January as a “trifle dodgy”, gloating: “If you want something to happen in this country, you should get the leader of the opposition to suggest it.”

He called for confirmation that it would contain the two elements put by the Tories – annual targets to cut emissions, and an independent watchdog to monitor progress. “Can we have a proper climate change bill, not some watered-down version?” he asked.

But Mr Blair said he could not say what was in the Queen’s speech, which will open the next parliamentary session, until it was published. He added that instead of saying the Tories’ plans were a “trifle dodgy”, he would now say they were simply “dodgy”.

Year on year targets were “very, very difficult to deliver”, he argued, saying that although it was vital to take action on climate change, “it’s also got to be practicable and workable.and entirely compatible with the interests of business and consumers as well”.

Mr Blair went on to note that the tax commission’s proposals last week failed to offer any suggestions for green taxes, despite Mr Cameron’s promise to shift tax burden towards pollution and away from wealth.

“It’s an interesting example of how government should not make policy,” he said.