Ever since the military success of the British-led mission to oust Muammar Gaddafi in 2011, David Cameron has recoiled from any overarching definition of his approach to foreign intervention. He has reassured MPs there will be no Cameron Doctrine.

It may be in part because he is a practical shire Tory and shire Tories shun theory, especially in foreign policy. Doctrines lead to inflexibility, utopianism and at worst messianic interventions that create unforeseen killing fields of religious or ethnic conflict.

In opposition Cameron was fond of saying: "You cannot drop democracy on a country from 30,000ft." Foreign policy was one of the few areas in which he was willing to set himself apart from Tony Blair. His cautious stance also reflected the prevailing mood in Whitehall post-Iraq, as well as a certain war wariness in the Ministry of Defence faced by the unproductive grind in Afghanistan.

Barack Obama's own determination to close "the decade of war" added to the instinct to hunker down and bring the troops home.

Yet, as his sweep this week through Algeria, Libya and Liberia has shown, something has altered in the Cameron psyche.

It is still impossible to imagine Cameron making a speech similar to Blair's Chicago address setting out the case for liberal interventionism, but the combination of the Gaddafi downfall, the growing UK military alliance with France, the Arab spring, and now his chairmanship of the G8 this year has emboldened him.

He may remain an instinctive conformist, but he has become a conformist with a cause. His language and actions have changed. He talks of an existential and generational threat posed by al-Qaida and its offshoots in northern Africa, and now draws a direct link between this new terrorism and a threat to British national interests both at home and abroad.

Countries that were off limits on the Foreign Office map are starting to be re-examined. The hostage crisis in southern Algeria alerted No 10 to how sparse their contacts were with the country, even though it was a regional power broker.

The idea that the country should be seen solely as a French sphere of influence is now regarded as a form of outmoded post-colonial thinking. The aim is to offer intelligence to the Algerians, a commodity they rate.

In Tripoli on Thursday at his press conference Cameron acknowledged regime change was sometimes necessary even if it came at a price. "When a brutal dictator is removed after 40 years you inevitably take the lid off all sorts of pressures and tensions that have to be dealt with."

But he said it was a fiction to suggest Britain would be safer if strongmen like Gaddafi were still in power. "The history of brutal dictatorships in north Africa and the Middle East has led some to think that somehow they will make us safer at home. That is completely wrong. I think it stores up problems for the future and in the long run. I think we are safer if we have secure stable, prosperous democracies. That is why I think the Arab spring is still part of the solution rather than the problem."

It was also striking that he put democracy at the heart of the fight against terrorism. "If we are to have a successful generational struggle against Islamic extremism, the alternative of a more open society and a more open democracy has to be part of the answer."

He is much taken by the theory of ungoverned spaces – that failed states become the incubators for terror, the argument that led to the Bush intervention in Afghanistan. Asked by Tom Bradby from ITN whether in office the merits of Blair's foreign policy had become clearer, he did not reject the notion.

Yet Cameron refuses to be seen as a born-again neocon. For a start, British officials insist that when Cameron recently talked of a generational struggle against terrorism, he was only making reference to the longstanding worldwide terrorist threat, and not something new, particularly focused on north Africa. He says the percentage of the threat to Britain coming from Afghanistan and Pakistan has been reduced, but only from 75% to 50%. Indeed, that is one reason why he will be hosting a rare conference at Chequers on Sunday at which the Pakistani and Afghan leaderships will discuss a joint security approach after the British leave in 2015.

He stresses he is not being drawn into a quagmire in north Mali, saying the British contribution is very modest and defined. Privately he feels compelled to help the French. With Obama so loth to intervene – to the UK's under-reported frustration – the two military powers in Europe are thrown ever closer together.

Above all he keeps repeating that he does not see purely military solutions to these problems, something he clearly feels Blair was prone to do. He is fond of saying: "If you only have a hammer, you see every problem as a nail. It is about using all the tools in the box."

Somalia is his model for what he describes as this "tough but intelligent approach". The tools include "a combination of tougher action on security, counterterrorism co-operation, diplomacy, political solutions and aid".

For Cameron, international aid is not just a moral good, but some soft power in the fight against terrorism and reaction. Many view Cameron's commitment to the British aid budget as the last withered fig leaf of his rebranding of a modern Tory party. But in private and public he is passionate about the issue, and gently scathing of those in his party who tell him British aid fosters corruption or retards economic growth.

Like Blair in 1995 at the famous fundraising Gleneagles G8 summit, he has been given a rare platform as this year's chairman of the G8 to champion the cause of aid. Equally his co-chairmanship of the UN's high-level panel on the successors to the 2015 millennium development goals – the purpose of his visit to Liberia – requires him to take the issue seriously.

He has come up with the notion of a "golden thread" linking aid efforts. In essence it is a shift away from purely the quantity of aid, the focus of Blair's G8, to addressing issues such as "stable government, lack of corruption, human rights, the rule of law and transparent information".

Critics say Cameron's golden thread is just a list, as opposed to a thread. But many aid agencies are impressed with the time and political capital he is expending on the issue.

But as Blair found to his cost, the more your foreign policies win plaudits abroad, the more you must worry what your backbenchers are thinking.