Terms under which Muammar Gaddafi could leave power are being explored by the UN envoy on Libya as the US, France and other countries signal that he could stay in the country after stepping down.

Abdul-Elah al-Khatib of Jordan, the UN special representative, is due to return to the Libyan capital, Tripoli, and the rebel stronghold of Benghazi next week for talks with both the regime and opposition about a political solution to end the crisis.

Diplomats said on Thursday that Khatib was going back to work on the issue of "sequencing" the linked issues of Gaddafi surrendering power, a ceasefire and talks on a political transition. Last week the international contact group on Libya authorised Khatib to discuss terms. "Gaddafi must leave power according to a defined framework to be publicly announced," it said. That framework is being quietly assembled.

Britain's formal position is that Gaddafi should face justice at the international criminal court, which has accused him of crimes against humanity dating back to the start of the uprising in February. Gaddafi's son Saif al-Islam and intelligence chief, Abdullah Senussi, are also wanted.

Khatib, a former Jordanian foreign minister, is keeping a low profile, but some Nato governments are less reticent and say he senses a greater readiness in Tripoli to listen to his proposals. Libya denies there is any discussion of Gaddafi's departure.

France's foreign minister, Alain Juppé, said on Wednesday that Gaddafi could stay in Libya if he stood down. "One of the scenarios effectively envisaged is that he stays in Libya on one condition which I repeat – that he very clearly steps aside from Libyan political life," Juppé told LCI TV. "A ceasefire depends on Gaddafi committing clearly and formally to surrender his military and civilian roles."

The latest US position is that it is "up to the Libyan people to decide" whether he could stay in the country.

Italy's foreign minster, Franco Frattini, said on Thursday that Rome would back any decision by the Libyan people for an "internal solution" to Gaddafi's relinquishing power.

The idea that Gaddafi could remain in Libya after stepping down reflects a growing consensus that it would be hard to remove him from Tripoli without large-scale bloodshed – and impatience to conclude the Nato military action.

Saad Djebbar, a London-based international lawyer who has advised the Libyan regime, said that any plan for Gaddafi's departure would have to be based on two pillars: the first would be for him to leave power but be permitted to stay in Libya while talks take place on a transition – "a face-saving solution so it will not look as if he has been pushed out".

The second pillar, Djebbar said, would have to be immunity from prosecution for Gaddafi and his family — by an amendment to the UN security council resolution calling for an investigation by the ICC. That position appears to be backed by Russia.

Nato governments are careful to stress that any such deal would have to be agreed by the rebel National Transitional Council, which is based in Benghazi. But Guma Elgumaty, its London representative, dismissed the idea that Gaddafi could remain in Libya. "It has no merit and no chance of succeeding," he insisted. "Gaddafi will either leave Libya or be killed."

US officials met Gaddafi representatives in Tunisia last Saturday to press the Libyan leader to end the fighting.

A senior Obama administration official said: "The message was simple and unambiguous — Gaddafi must leave power so that a new political process can begin that reflects the will and aspirations of the Libyan people."