Gordon Brown has dismissed the idea of a broken society in Britain, saying the country is "decent and compassionate".
The prime minister was speaking at the opening day of the Edinburgh Book Festival - where he was being interviewed by crime writer Ian Rankin.
In a wide-ranging discussion, he spoke about domestic and global problems as well as his own work as an author.
Along with political works, Mr Brown has written a book called Courage about great figures such as Nelson Mandela.
The prime minister, who was a surprise guest at the festival, told the audience there: "I don't think the British people have ever been broken by anything or anyone.
If people see people doing great things, then these are role models for young people
Gordon Brown
"I feel there is so much good being done in different parts of our country.
"I think Britain is basically a decent, compassionate society and most people want to see things change for the better."
Mr Brown highlighted knife crime as "the biggest problem at the moment" in some cities.
But he said the government alone could not tackle it, saying the community also had a role to play in changing the culture to make carrying knives unacceptable.
Mr Brown said he had written Courage: Eight Portraits, which is about famous role models, to encourage more people to follow their example.
He said: "You celebrate them and you create more as a result of that. If people see people doing great things, then these are role models for young people."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.
Bookmark with:
What are these?