David Cameron delivers his keynote speech to the Conservative party conference Press Association

David Cameron has urged Britain to shun "can't-do sogginess" and instead lead itself from recession by tapping into Britain's indomitable bulldog spirit.

Speaking against a chilling backdrop of ever gloomier economic news, on the day that new official figures showed Britain's economy had flatlined over the past nine months, he sought to lift the country's mood by saying: "Let's show the world some fight", adding: "We can turn this ship around."

Closing the Conservative conference in Manchester, the prime minister said: "Frankly there's too much can't-do sogginess around. We need a sharp, focused, can-do country" that would form the basis of a new economy built on fairness.

In a patriotic speech suffused with one nation rhetoric and promises to tear down educational "apartheid" in Britain, he repeatedly hailed the country's historic capacity to recover from reverses, such as the loss of empire, the threat of communism or economic decline in the 1970s.

"Britain never had the biggest population, the largest land mass, the richest resources – but we had the spirit," he said. "Remember it is not the size of the dog in the fight, it's the size of the fight in the dog. Overcoming challenge, confounding the sceptics, reinventing ourselves, this is what we do." He said: "It's called leadership," a phrase that occurred 17 times in his speech.

The attempt to offer optimism, as well as a portrait of a Tory purpose that goes wider than deficit reduction, ran the risk of appearing out of touch with the depth of economic crisis. Cameron fervently argued that Britain should not be paralysed by gloom and fear, saying it was "possible to turn this time of challenge into a time of opportunity".

His officials privately admitted it had been a difficult speech to pitch with Cameron only 18 months into government, the crisis in the euro overshadowing all else, and the need to balance optimism with realism. Cameron also had to tweak the speech at the last minute after an earlier draft appeared to instruct the entire country to pay back their credit card debts, a move that some calculated would shrink GDP by 15% at a stroke.

Despite a string of right-of-centre policy announcements during the week, the prime minister was firmly camped on the compassionate centre ground, defending the international aid budget, offering more help with parenting and legalising gay marriage as "a way of strengthening the ties that bind us". He declared: "I don't support gay marriage despite being a Conservative. I support gay marriage because I am a Conservative."

He also promised a new focus on getting very young children out of state care by allowing black children to be adopted by white families. "We've got people flying round the world to adopt babies while the care system at home agonises about placing black children with white families."

He also defended the way in which he had distributed the pain in the spending cuts, claiming controversially: "This is a one nation deficit reduction programme – from a one nation party." Similarly, he promised that the new economy he was in the process of building would be a different economy, built on solid ground and working for everyone.

But he offered little fresh detail on how growth was to be achieved, apart from the familiar litany of deregulation, controlling debt, tax breaks for enterprise and a determination to push through planning changes to give industry the space to grow.

Ministers are increasingly confident that the argument over planning reform is being won, with Cameron angrily telling his implacable critics: "Take your arguments down the jobcentre. We've got to get Britain back to work."

In probably the strongest section of his speech, he claimed "something massive" was already under way in schools as standards and aspiration rose. "Rigour back in learning. Standards back in schools. Teachers back into control. Yes, the Conservatives are back in government."

An old Etonian, he demanded private schools take greater responsibility by starting or sponsoring more academies: "The apartheid between our private and state schools is one of the biggest wasted opportunities in our country today, so let it be this party that helps tear it down."

To some of his loudest applause he said: "Believe me, I do understand and I am disgusted by the idea that we should aim for any less for a child from a poor background than a rich one. I have contempt for the notion that we should accept narrower horizons for a black child than a white one. Yes, it is the age-old irony of the liberal left: they practise oppression and call it equality." Without mentioning Ed Miliband, he accused Labour of giving Britain a casino economy and welfare society.

He said the government's deficit reduction programme was "just one big bail out of the last Labour government". Labour was "on a sort of national apology tour", he said, adding: "There has not been a peep on the one thing they really need to say sorry for – wasting billions and billions of your money."

Miliband, preparing to reshuffle his shadow cabinet, was struck by the number of themes he set out in his speech last week, including attacks on personal irresponsibility and vested interests, that reoccurred in Cameron's.

But Cameron also offered a stronger defence of liberal interventionism than Miliband by defending the British leadership role in Libya: "This is a party – ours is a country – that never walks on by. Earlier this year some people said to me: 'Libya's not our concern', 'don't start what you can't finish', and even – 'Arabs don't do democracy'.

"But if we had stood aside this spring, people in Benghazi would have been massacred. And don't let anyone say this wasn't in our national interest … let's be proud of the part we played in giving the Libyan people the chance to take back their country."