By Louis Charbonneau, John Irish and Parisa Hafezi

LAUSANNE, Switzerland (Reuters) - U.S. Secretary of State John Kerry and his German and French counterparts extended marathon talks in Switzerland on Wednesday for a second day beyond a self-imposed deadline to reach a preliminary agreement with Iran on its nuclear programme.

A diplomat close to the talks said late on Wednesday that a deal could be announced within hours but had not yet been reached, and the talks could still collapse.

Kerry and German Foreign Minister Frank-Walter Steinmeier announced they would stay at least until Thursday. In a potentially hopeful sign, French Foreign Secretary Laurent Fabius returned for more talks after flying back to Paris the previous day because progress had been too slow.

Six world powers - the United States, Britain, France, Germany, Russia and China - aim to stop Iran from gaining the capacity to develop a nuclear bomb. Tehran wants to lift international sanctions that have crippled its economy, while preserving what it says it its right to peaceful nuclear technology.

The sides were meant to reach a preliminary accord in the Swiss city of Lausanne which would provide an outline for a final deal to be reached by June 30. The preliminary deal was meant to be achieved by midnight on March 31, but the sides are under pressure not to go home empty handed.

The powers and Iran said they had moved closer, but both sides accused the other of refusing to offer proposals that would break the deadlock.

Washington said it was willing to walk away from the talks unless the sides could agree on a preliminary framework.

The talks represent the biggest chance of rapprochement between enemies Iran and the United States since the Iranian revolution in 1979, but face scepticism from conservatives in both Washington and Tehran.

Even if there is a preliminary deal, it will be fragile and incomplete and there is no guarantee that talks on a final deal would not collapse in the coming months.

CHAOS, DISUNITY

After missing the self-imposed March 31 deadline, the negotiators ended talks in the early morning hours of Wednesday with an air of chaos, disunity and cacophony as delegations scrambled to get contradictory viewpoints across.

Both Kerry and Germany's Steinmeier announced their intention to spend another night in Lausanne to build on the progress made.

"We continue to make progress but have not reached a political understanding. Therefore, Secretary Kerry will remain in Lausanne until at least Thursday morning to continue the negotiations," Kerry's spokeswoman Marie Harf said.

A French official said late on Wednesday that Fabius had decided to return to rejoin the talks, adding that this was not necessarily a sign that a deal was close. ‎

All sides have described the talks as fragile. Asked by a reporter if collapse of the negotiations was a possibility, Germany's Steinmeier replied: "Naturally."

"Whoever negotiates has to accept the risk of collapse," he added. "But I say that in light of the convergence (of views) that we have achieved here in Switzerland, in Lausanne, it would be irresponsible to ignore possibility of reaching an agreement."

He said he would consider further travel plans on Thursday morning depending on how the talks develop. New proposals and recommendations were expected later on Wednesday, he said, but the onus was on Tehran to make them.

Iran's Foreign Minister Mohammad Javad Zarif told reporters it was the major powers who must budge, not Tehran.

"Progress and success of the talks depends on the political will of the other party ... and this is an issue they have always had a problem with," he told reporters.

White House spokesman Josh Earnest told reporters in Washington "the time has come for Iran to make some decisions". He repeated a warning that the United States was prepared to walk away from the negotiations before a June 30 deadline if no political framework deal comes out of Lausanne.

But as negotiators from the powers met Zarif again on Wednesday, Iran expressed optimism that an initial agreement was within reach. So did Russia, which is Iran's main sympathiser among the powers.

Senior Iranian negotiator Abbas Araqchi told state television that Tehran hoped to wrap up the talks on Wednesday evening. He added that he expected the parties to issue a joint statement declaring that "progress has been made in the talks and that we have come to a solution on key issues. We will have the solutions in written form."

Story continues