* EU member states agree 3-month flexible extension
* UK government must still agree to extension text
* France accepts delay after UK election prospects rise
* Parliament to vote on Johnson election demand (Recasts headline and lead)
BRUSSELS, Oct 28 (Reuters) - The European Union on Monday agreed a 3-month flexible delay to departure from the bloc as Prime Minister Boris Johnson pushes for an election after opponents forced him to request an extension he had vowed never to ask for.
Just three days before the United Kingdom is due to leave the EU on Oct. 31 at 2300 GMT, Brexit is hanging in the balance as British politicians are no closer to reaching a consensus on how, when or even if the divorce should take place.
Johnson, who became prime minister by pledging - "do or die" - to deliver Brexit on Oct. 31, was driven into requesting a postponement after he was defeated in parliament over the sequencing of the ratification of his divorce deal.
The 27 countries that will remain in the EU after Brexit agreed on Monday to put off Brexit until the end of January with an earlier departure possible should the faction-ridden UK parliament ratify their separation deal.
"The EU27 has agreed that it will accept the UK's request for a Brexit 'flextension' until 31 January 2020," European Council President Donald Tusk said in a tweet, referring to the idea of a "flexible extension".
But EU member states will need Britain to formally respond to its offer of a 3-month delay to Brexit before launching a "written procedure" whereby governments will have 24 hours to accept or reject the delay.
"We can only launch the written procedure when we have the agreement of the UK government on the text," said a senior EU official.
Two senior EU diplomats confirmed that the written procedure period agreed was 24 hours, effective from the time London accepts the offer of a Brexit delay from Oct. 31 to Jan. 31.
Britain's departure has already been delayed twice - from March 29 and April 12 - after Johnson's predecessor, Theresa May, failed three times to get her deal ratified by parliament.
With British politics still paralysed over carrying out Brexit 3-1/2 years after a 52%-48% referendum vote in favour of Leave, Johnson is demanding parliament approve an election on Dec. 12 in return for more time to adopt his deal.
But he needs the support of two-thirds of the 650 lawmakers for a new election. A House of Commons vote is due later on Monday.
The EU, forged from the ruins of World War Two as a way to prevent another devastating conflict in Europe, is fatigued by Britain's Brexit crisis but keen not to be held responsible for an economically tumultuous "no-deal" Brexit.
French President Emmanuel Macron had been the main hurdle to an extension, arguing there had to be a good reason for a delay and that the British needed to break their own political deadlock. But a source close to Macron said the prospect of an election in Britain had strengthened significantly.
The source stressed that the third Brexit delay would come with conditions, including a refusal to renegotiate the divorce agreement and giving a green light to other EU countries to meet without Britain to discuss the bloc's future.
The latest delay plan envisages that Britain could be out on Dec. 1 or Jan. 1 should parliament ratify the agreement in November or December, respectively, according to diplomats who deal with Brexit in Brussels.
The EU will state that the extension, the third granted so Britain can sort out the details of its departure, will not be used to renegotiate the divorce treaty again, and that London should not impede other essential work by the EU on projects ranging from budgets to climate policies. (Writing by Guy Faulconbridge Editing by Mark Heinrich)