By Gabriela Baczynska and Elizabeth Piper

BRUSSELS (Reuters) - European Union leaders have given Prime Minister Theresa May two weeks' reprieve, until April 12, before Britain could lurch out of the EU if she fails to persuade lawmakers to back the withdrawal treaty she concluded with Brussels.

But after seven hours of summit brainstorming on Thursday, her 27 peers kept a host of options open, ramping up pressure on parliament to support May, giving Britain an outside chance of staying in for much longer - but also preparing to deflect blame for the chaos of any no-deal Brexit.

May had wanted to be able to delay Britain's departure until June 30 to tie up legislative loose ends, and tried to reassure the EU that she could overturn two heavy defeats to clinch a last-gasp parliamentary ratification of her deal next week, so allowing a status-quo transition period to come into effect.

EU leaders had planned to endorse a shorter extension, to May 22, the eve of EU parliamentary elections, and leave any discussion of how to deal with May losing until next week. But diplomats said the prime minister singularly failed to reassure them she could win. Some sensed she did not believe it herself.

After May left the room, and with French President Emmanuel Macron pitching a surprise ultimatum for Britain to be out, deal or no deal, by May 7 -- the eve of a summit on the EU's post-Brexit future -- the meeting plunged into frantic debate.

The outcome, with which May declared herself satisfied, was that the May 22 date will apply if parliament rallies behind her next week. If it does not, Britain will have until April 12 to offer a new plan or choose to quit without a treaty.

That date corresponds to the six weeks' legal notice required for the EU election - which the Union would insist Britain hold on May 23 if it remains a member. If it does not hold the election, leaders said, the very last date Britain must leave would be June 30, before the new EU parliament convenes.

Story continues

"OPTIONS REMAIN OPEN"

Until April 12, said summit chair Donald Tusk, "all options will remain open and the cliff-edge date will be delayed".

"The UK government will still have a choice between a deal, no deal, a long extension or revoking Article 50 (the withdrawal notice)," he told a news conference.

If Britain decides by April 12 against holding the EU election, it could then leave the EU without a deal at any time up to May 22.

May said she would not cancel Brexit or seek a long delay that would mean asking people to vote in EU elections three years after voting to leave. She insisted she could secure a deal next week.

Many in London doubt that, not least after she offended many lawmakers on Wednesday by publicly blaming them for the deadlock. She tried to soften those remarks somewhat on Thursday.

"What this decision tonight does is show the clear choice that is open to MPs," May said. "I think the choice is clear for people."

But May's stated belief in her strategy of a third vote did not communicate itself to the summit table.

"It did not go well," said one EU official familiar with the talks. "They basically realized that she doesn't really believe it herself. They don't want to be seen to be forcing the Brits out now. But they are looking for ways to end the agony."

While some brinkmanship from Brussels may be part of a strategy to bounce reluctant British legislators into backing May, there is also a growing impatience that efforts to avoid a messy Brexit are bogging the EU down when it has other priorities, from a weakening economy to rising nationalism.

"WE HAVE BOUGHT TWO WEEKS"

Macron has led the charge, calling for Britain, long a thorn in France's plans for deeper European integration, to put up or shut up on Brexit. "We have come up with a response that protects our interests," he said.

"It is up to the British to sort out their own internal contradictions. As for us, we don't have any."

May's opponents at home range from hard-core Brexit supporters who say her deal gives the EU too much influence in Britain to others, inside and outside her own Conservative party, who would prefer to stay much closer to the EU or cancel Brexit.

Voicing the fears of business that a "no-deal" Brexit would hurt economies across the continent, German Chancellor Angela Merkel argued for caution, saying she would "work to the last minute" to avoid a disorderly departure.

By pushing the Brexit crunch toward Britain's April 12 deadline to declare its decision on holding an EU election, EU diplomats said, the leaders also dodged potential blame if they had simply allowed Britain to crash out next Friday.

"That way, Merkel and the rest of the EU can avoid blame for forcing the British out," one EU official said. "It will be up to the British themselves to say they are leaving with no deal."

The basic problems of Brexit remain, however. Britain could still crash out without a transition, disrupting business and souring relations before the sides sit down to negotiate a trade pact and decide how to manage their politically sensitive land border in Ireland.

"Today was a long seven hours that bought us two weeks," another EU diplomat said.

"It just lets us say with a clear conscience that we didn't throw them under the bus on March 29 ... But before April 12, we will face the very same questions as now."

(Reporting by Robin Emmott, Gabriela Baczynska, Elizabeth Piper, Richard Lough, Anthony Deutsch, Philip Blenkinsop, Giulia Paravicini, William James, Thomas Escritt, Jan Strupczewski, Andreas Rinke and Alastair Macdonald in Brussels and Guy Faulconbridge and Kylie MacLellan in London; Writing by Alastair Macdonald, Jan Strupczewski and Elizabeth Piper; Editing by Kevin Liffey)