Yemen's President Ali Abdullah Saleh said on Saturday he was prepared to step down if allowed a dignified departure, but the opposition accused him of maneuvering to hold on to power.
"I could leave power ... even in a few hours, on condition of maintaining dignity and prestige," Saleh told Al Arabiya TV, adding that he would remain in charge of the ruling party even if stood down.
"I have to take the country to safe shores ... I'm holding on to power in order to hand it over peaceably ... I'm not looking for a home in Jeddah or Paris."
Earlier Foreign Minister Abubakr al-Qirbi told Reuters a deal to transfer power peacefully could emerge shortly based on an offer by Saleh to quit by the end of the year. But a deal did not appear imminent since government opponents had hardened their demands.
"I will transfer power to the people, who are the source and owner of power," said Saleh, who warned Yemen was a "time bomb" and could slide into civil war like Somalia across the Gulf of Aden.
"If we do not act, along with good-willed and friendly countries, to close the rift and start a political dialogue, there will be a devastating civil war that will disturb the whole region," he said.
"They should have learnt a lesson from Somalia," said Saleh.
Yemen, a poor and tribally divided country, that has become a base for al-Qaeda next to the world's top oil producer Saudi Arabia, has been in upheaval since January when the example of the Tunisian and Egyptian revolutions set off popular demonstrations to end Saleh's 32-year rule.
Talks have been under way on two tracks to hash out the details of a deal on a peaceful transition of power.
But the leader of Yemen's opposition coalition said the sides still had significant differences, and that while there were some contacts he did not consider them as negotiations.
"We still have a very big gap," said Yassin Noman, the rotating head of Yemen's opposition coalition. "I think he (Saleh) is maneuvering."
Yemeni political sources said some issues that could hold up a deal were whether the opposition would give guarantees not to pursue Saleh and his family legally. Saleh opponents also want to be sure his close relatives leave positions of power.
"I hope it (agreement) will be today, before tomorrow," Qirbi told Reuters in an interview, adding that the time frame of a transfer of power could be negotiated.
Saleh, who oversaw the 1990 unification of north and south Yemen and emerged victorious from a civil war four years later, told tribes in Sanaa on Saturday that he would "work to avoid bloodshed using all possible means".
"President Saleh is willing to look at all possibilities, as long as there are really serious commitments by the JMP (opposition) to come and initiate a serious dialogue between them and the ruling party," Qirbi said.
But an opposition leader cast doubt on prospects for a swift accord and a Sanaa diplomat cautioned it was too soon to discuss an outcome, saying it could "go either way".
Qirbi said discussions were focusing on the time frame of a transition, among other issues. "I think the time period is something that can be negotiated. It shouldn't be really an obstacle to reach an agreement".
"I think things are very close if the real intention is really to reach an agreement. But if there are parties who want to obstruct it then of course one cannot predict."
Saleh, speaking to Arabiya television, confirmed that meetings had taken place in the past two days that included a discussion about a presidential address to parliament.
"There was a meeting yesterday and the day before ... to discuss ways to end the crisis," Saleh told Arabiya.
Saleh said the U.S. ambassador was present at talks in the past two days and that he would welcome Saudi or Gulf mediation.
But he was scathing about the opposition, who he said were mainly socialists and Islamists trying to seize power on the back of the youth protest movement.
"They are a minority. They can organize a march of 20,000 people? I can get two or three million. How can a minority twist the arm of the majority?" he said.
Saleh has responded to the mass protests with a violent crackdown and a series of concessions, all rebuffed by opposition parties, including one this week to transfer power after the drafting of a new constitution and parliamentary and presidential elections by the end of the year.
Western countries are concerned that al-Qaeda militants could take advantage of any power vacuum arising from a rocky transition if Saleh, a U.S. and Saudi ally fighting for his political life, steps down after 32 years in office.
Analysts have said Saleh's role as a key U.S. anti-Qaeda ally has likely contributed to Washington's relatively muted response to deadly crackdowns on pro-democracy protests in Yemen.
A report in Saturday's Washington Post newspaper cited U.S. officials as saying their intelligence agencies thought al-Qaeda's Yemen-based branch could be close to launching an attack in a bid to capitalize on the unrest.
The tide against Saleh appears to have turned after plainclothes snipers loyal to the president fired into an anti-government crowd, killing 52 people on March 17.
That led to a series of defections that eroded Saleh's position including by top military commanders such as General Ali Mohsen, as well as ambassadors, lawmakers, provincial governors and tribal leaders, some from his own tribe.
Mohsen, considered the second strongest man in Yemen and a regional army commander who has vowed to defend the protesters, is leading efforts to form a transitional council grouping all sides, according to sources close to the secret negotiations.
Saleh said the defections came mainly from among Islamists of the Muslim Brotherhood and some had returned to his side. He said Mohsen had been acting emotionally because of Friday's bloodshed but that security forces were not behind the deaths.
"It was 41 people (who died), I heard. Their identity is unknown ... The Yemenis are snipers, they are all snipers, all trained in weapons," he joked on Al Arabiya. "A group has been arrested. They are being investigated and will face justice."