* Lavrov says direct talks to start on Friday
* Ban urges Syria to release prisoners
* Solution to three-year war remains far off
* Opposition, government at odds over Assad's fate
* Assad ally Iran could make a difference, Kerry says
By Gabriela Baczynska and Stephanie Nebehay
MONTREUX, Switzerland, Jan 22 (Reuters) - Syria's government and opposition, meeting for the first time, vented their mutual hostility on Wednesday but a U.N. mediator said the enemies may be ready to discuss prisoner swaps, local ceasefires and humanitarian aid.
Russia said the rival sides had promised to start direct talks on Friday despite fears that a standoff over President Bashar al-Assad's fate would halt the push for a political solution to Syria's civil war, which has killed over 130,000 and made millions homeless.
Even if the sides are willing to discuss limited confidence-building measures, expectations for the peace process remain low, with Islamist rebels and Assad ally Iran absent and a solution to the three-year war still far off.
Western officials were taken aback by the combative tone of Syrian Foreign Minister Walid al-Moualem at the one-day a U.N. peace conference in Switzerland, fearing follow-up negotiations would never get off the ground due to the acrimony.
But after a day of bitter speeches in the lakeside city of Montreux, international mediator Lakhdar Brahimi signalled that both sides were ready to move beyond rhetoric. "We have had some fairly clear indications that the parties are willing to discuss issues of access to needy people, the liberation of prisoners and local ceasefires," he told a news conference.
United Nations Secretary-General Ban Ki-moon said he had urged Damascus to release detainees as a confidence-building measure and appealed to both sides. "Enough is enough, the time has to come to negotiate," he told reporters.
Russia, which co-sponsored the Montreux meeting with the United States, said the rival Syrian delegations had promised to sit down on Jan. 24 for talks which were expected to last about seven days.
Foreign Minister Sergei Lavrov played down the recriminations on Wednesday, when the opposition called for Assad to hand over power - a demand dismissed by Moualem, who in turn graphically described atrocities by "terrorist" rebels.
"As expected, the sides came up with rather emotional statements, they blamed one another," Lavrov told reporters. However, he added: "For the first time in three years of the bloody conflict ... the sides - for all their accusations - agreed to sit down at the negotiating table."
Lavrov, who met Moualem and Syrian opposition leader Ahmed Jarba on Wednesday, urged Assad's opponents and their foreign backers not to focus exclusively on leadership change.
Wednesday's meeting exposed sharp differences on forcing out Assad, both between the government and opposition, and among the foreign powers which fear that the conflict is spilling beyond Syria and encouraging sectarian militancy abroad.
Jarba accused Assad of Nazi-style war crimes and demanded the Syrian government delegation sign up to an international plan for handing over power. Moualem insisted Assad would not bow to outside demands, denouncing atrocities committed by rebels supported by the Arab and Western states whose delegations were sitting in the conference room.
"Hope exists but it's fragile. We must continue because the solution to this terrible Syrian conflict is political and needs us to continue discussions," said French Foreign Minister Laurent Fabius. "Obviously when we hear Bashar al-Assad's representative, whose tone is radically different, we know it will be difficult."
Moualem called on foreign powers to stop "supporting terrorism" and to lift sanctions against Damascus.
Referring to rebel acts, he said: "In Syria, the wombs of pregnant women are cut open, the foetuses are killed. Women are raped, dead or alive ... Men are slaughtered in front of their children in the name of the revolution."
He insisted Assad's future was not in question, saying: "Nobody in this world has a right to withdraw legitimacy from a president or government ... other than the Syrians themselves."
U.S. Secretary of State John Kerry echoed the rebel view that there is "no way" Assad can stay under the terms of a 2012 international accord urging an interim coalition. But Lavrov said all sides had a role and condemned "one-sided interpretations" of the 2012 pact.
Saudi Arabia, which backs the Sunni rebels, called for Iran and its Shi'ite Lebanese ally Hezbollah to withdraw forces from Syria. Iran, locked in a sectarian confrontation across the region, was absent, shunned by the opposition and the West for rejecting calls for a transitional government.
Kerry acknowledged Tehran could play a role in a solution. "Iran certainly does have an ability to be helpful and make a difference," he told reporters. "There are plenty of ways that that door can be opened in the next weeks or months, and my hope is they will want to join in a constructive solution."
The conference has raised no great expectations, particularly among Islamist rebels who have branded Western-backed opposition leaders as traitors for even taking part.
U.N. chief Ban opened proceedings by calling for immediate access for humanitarian aid convoys to areas under siege. "Great challenges lie ahead but they are not insurmountable," Ban said, condemning human rights abuses across the board.
But there was little sign of compromise on the central issue of whether Assad, who inherited power from his father 14 years ago, should make way for a government of national unity.
He himself says he could win re-election later this year and his fate has divided Moscow and Washington. Both endorse the conclusions of the 2012 meeting of world powers, known as Geneva 1, but differ on whether it means Assad must go now.
Lavrov repeated Moscow's opposition to "outside players" interfering in Syria's sovereign affairs and prejudging the outcome of talks on forming an interim government. He also said Iran - Assad's main foreign backer - should have a say.
The Kremlin is wary of what it sees as a Western appetite for toppling foreign autocrats that was whetted in Libya in 2011. Moscow opposes making Assad's departure a condition for peace. Speaking of the Geneva Communique, Lavrov said: "The essence of this document is that mutual agreement between the government and opposition should decide the future of Syria."
Kerry also spoke of "mutual" agreement among Syrians, but one that excluded Assad. "We see only one option - negotiating a transition government born by mutual consent," he said. "That means that Bashar al-Assad will not be part of that transition government."
Despite the differences, however, some participants believe common interests in reining in violence could rally the West, Russia and possibly even Iran behind some form of compromise.
A last-minute invitation from Ban to Iran was revoked after the Syrian opposition threatened to boycott the talks - a move that threatened to undermine months of U.S. and Western efforts to cajole Jarba's National Coalition into taking part.
President Hassan Rouhani said from Tehran that Iran's exclusion made it unlikely the conference could succeed.
WAR RAGES IN SYRIA
During the speeches in Montreux, the war went on in Syria.
The Syrian Observatory for Human Rights monitoring group reported clashes and air strikes around the country. Around Damascus, government artillery hit villages and rebels clashed with the army in the neighbourhood of Jobar on the northeast fringe of the capital, it said.
The release of photographs apparently showing prisoners tortured and killed by the government was cited by Jarba and Western ministers. The Syrian government rejected the report as not objective and aimed at undermining negotiations.
In Damascus, where life limps on amid bombardments and checkpoints, weary residents cautiously hope for better.
"I really don't think much will come out of it, but the alternative is no talks at all, and that's not much better," said Ruba, a mother of two.
(Additional reporting by Tom Miles, Kahled Yacoub Oweis, Mariam Karouny, Dominic Evans, Samia Nakhoul, John Irish, Stephanie Nebehay, Lesley Wroughton and Johnny Cotton in Montreux, Guy Faulconbridge in London and Laila Bassam, Parisa Hafezi in Ankara, Alexander Dziadosz, Oliver Holmes and Stephen Kalin in Beirut; Writing by Alastair Macdonald and David Stamp, editing by Peter Millership and Giles Elgood)