Britain and France aim to deliver aid and discuss how to stabilise country as hunt for Gaddafi continues

David Cameron arrived in Tripoli on Thursday on a high-risk visit to the Libyan capital with the French president, Nicolas Sarkozy – the other main western champion of the five-month Nato bombing campaign that eventually ousted Muammar Gaddafi from power.

The foreign secretary, William Hague, is also on the visit, as well as the French intellectual Bernard-Henry Lévy, who persuaded Sarkozy that a victory for the Libyan rebels was essential if the momentum of the Arab Spring was to be retained.

Cameron is bringing details of an aid package and will hold talks with the leaders of the National Transitional Council (NTC) on the progress it is making on stabilisation, driving out the remaining pockets of Gaddafi-supporting resistance in the south of the country and preparing for a democratic future.

It will be the first visit to Libya by western leaders since the collapse of the Gaddafi regime, and is likely to spark scenes of acclaim for Sarkozy and Cameron at some political and diplomatic risk.

It is also expected that Cameron will fly to Benghazi, the cradle of the resistance and still the base for the NTC.

The trip has been under discussion for over a fortnight, but the two leaders have been advised that the security situation is safe enough for them to travel to a city that, only three weeks ago, appeared to be under the iron grip of Gaddafi.

It had been intended that the trip would remain unannounced until the two leaders reached the Libyan capital, but news leaked in Paris and was picked up on international websites.

Downing Street, on security advice, refused to confirm the planned visit until the prime minister's plane had landed in Tripoli. The NTC confirmed the trip.

The visit is designed to reap some domestic political kudos for what has, in effect, been the first war that Cameron waged rather than inherited from the Labour government.

British government sources insisted there would be no triumphalism on the visit nor any echoes of George Bush's premature claim of "mission accomplished" at the end of the fighting in Iraq. Cameron is likely to meet civilians and some of those injured in the fighting.

Sarkozy is due to be travelling with a group of police officers who are expected to help advise the Libyans on security.

The leaders of the NTC are due to transfer their headquarters from Benghazi to Tripoli. Cameron and Sarkozy will meet the key figures on the council to discuss the future state of the economy and political developments. Gaddafi has yet to be captured, and is thought to be in the south of Libya.

Hague and the international development secretary, Andrew Mitchell, travelled to Benghazi during the Nato bombing campaign, but Cameron rejected a Sarkozy suggestion to travel to the country during the conflict, arguing that it might affect the fragile Arab League support for the campaign.

French papers noted that the visit coincided with a high-profile TV debate between the French socialist candidates.

It is also expected that the Turkish prime minister, Recep Tayyip Erdogan, will visit Libya as part of a wider north African tour.