Turkey's prime minister calls for Syrian president to listen to his people Reuters

The Turkish prime minister Recep Tayyip Erdogan has signalled that Turkey is ready to act as a mediator to broker an early ceasefire in Libya, as he warned that a drawn-out conflict risked turning the country into a "second Iraq" or "another Afghanistan" with devastating repercussions both for Libya and the Nato states leading the intervention.

In an exclusive interview with the Guardian, Erdogan said that talks were still under way with Muammar Gaddafi's government and the Transitional National Council. He also revealed that Turkey is about to take over the running of the rebel-held Benghazi harbour and airport to facilitate humanitarian aid, in agreement with Nato.

Speaking in Istanbul at the weekend, Erdogan said Gaddafi had to "provide some confidence to Nato forces right now" on the ground if there was to be progress towards the ceasefire the Libyan leader wanted and an "end to the blood being spilled in Libya".

His comments came as Nato leaders met in Brussels to finalise arrangements for the alliance - with Turkey's participation - to take over the enforcement of the UN no-fly zone from Tuesday, as well as for the more controversial air strikes against Gaddafi's ground forces.

Meanwhile, rebel forces completed their weekend take-over of a string of government-held oil towns, including Brega, Ras Lanuf and Bin Jawad, with the help of heavy coalition air strikes on pro-Gaddafi forces. By Sunday night their Their rapid advance westwards is heading for the Libyan leader's home town and stronghold, Sirte, where two loud explosions were heard.

The Turkish government, which is playing an increasingly important regional role and has the second largest armed forces within Nato, has been at the centre of the argument within the alliance over Libya, publicly clashing with the French president Nicolas Sarkozy.

Turkey opposed any outside military involvement before it began – Erdogan described the idea of Nato intervention as a "nonsense" — but has now agreed to participate in a non-combat role in the wake of the UN security resolutions and Arab League appeal.

His public challenge to US, British and French direct military intervention is likely to deepen Nato dissension and alarm western leaders who hoped Turkey had now acquiesced in the thrust of the Libya mission.

"We have been opposed to any unilateral action and we could never accept appeals such as that by the French minister for a new crusade," Erdogan told the Guardian, in a reference to comments made by France's interior minister, Claude Guéant. His government would carry out its obligations under UN resolutions. "But for Turkey, it's out of the question to shoot at Libyan people or drop bombs on the Libyan people," Erdogan said in reference to the emerging "no-drive zone" policy. "Turkey's role will be to withdraw from Libya as soon as possible" and "restore the unity and integrity of the country based on the democratic demands of the people", he added.

It was vital, Erdogan said, that "this deployment should not be carried out for Libya's oil. Of course there will be a price for these actions and no one can guarantee that Libya won't have to pay a price."

Repeatedly drawing parallels with Iraq and Afghanistan – which senior Turkish officials regard as a serious risk if there is a military stalemate – Erdogan said Iraq was "still paying a price" 20 years after the Gulf war of 1991. "I'm afraid we could see another Afghanistan or a second Iraq emerging. When western forces entered Afghanistan nearly 10 years ago, people were talking of it being over in days, and people said the same in Iraq. But a million have died and a civilisation has as good as collapsed. We don't want to see a similar picture in Libya."

If the conflict was prolonged, the Turkish prime minister warned of a backlash against countries now carrying out air strikes. "It will be devastating for the entire Libyan people, and the repercussions will not be restricted to Libya, but will have a direct impact on those countries that have intervened."

Erdogan added: "There is a civil war in Libya and we have to bring that to an end."

He had spoken to Gaddafi repeatedly before the air strikes and to the Libyan prime minister since, while Turkey's foreign minister was in close touch with the Benghazi-based opposition.

It was crucial that contacts were maintained with both sides, he said. "Gaddafi wants a ceasefire, this came up when I was talking to the prime minister, but it's important for those circumstances to mature. It wouldn't be consistent to keep shooting while demanding a ceasefire."

If the two parties to the conflict requested Turkey to play the role of mediator, the Turkish prime minister said "we will take steps to do that" within the framework of Nato, the Arab League and African Union. "We can never ignore the democratic rights and liberties called for by the people of Libya, and change and transformation can never be delayed or postponed," Erdogan said, adding that a leader such as Gaddafi, with no formal position, should be able to "lay the foundation for such a transformation".

Erdogan's AKP party and its programme of Islamic democratisation and greater national independence is widely admired in the Arab world, and Erdogan widened his warning to autocratic governments facing popular uprisings throughout the region: "Leaders who are resistant to change and their people's demands may find that brings an end to their being a leader."

Erdogan was also fiercely critical of European governments he said had misunderstood Turkey's embrace of "Islam and democracy simultaneously".

In its negotiations to join the EU, Turkey had faced "obstacles that no country had ever witnessed before," adding: "Never mind, we will do what we will do."

He was at pains to rebut criticism in the western media over the jailing of journalists caught up in the long-running investigation into an attempted military coup and claims that the government has used the case to intimidate sections of the press.

"These criticisms upset us very much," he said, adding that a total of 27 journalists had been convicted and jailed for crimes, including membership of terrorist organisations, coup plotting and sexual harassment. "Would that be accepted as normal in your country?"

None of these cases had been brought to court at the initiative of the government which, he said, had taken action to increase the independence of judges and prosecutors, and the efficiency and speed of the judicial process.