Theresa May looks set to avoid a humiliating second Commons defeat after a compromise deal was reached within Tory ranks over plans to write the Brexit date in law.
Behind-the-scenes efforts to prevent a revolt appear to have resulted in a situation which will see March 29 2019 written into the Government's Brexit legislation as the Prime Minister promised, but with flexibility allowing the date to be changed if negotiations with Brussels look set to stretch beyond that date.
Rebels who helped inflict Mrs May's first Commons defeat on Wednesday lined up behind the compromise, which has been put forward by prominent backbenchers on both sides of the EU referendum divide.
The Government is understood to be "looking closely" at the amendment tabled by MPs including Remain supporter Sir Oliver Letwin and Brexiteer Bernard Jenkin - which would give ministers flexibility to change the departure day if Parliament agrees. The Government has not formally supported the move but it would appear certain to back the measure if it presented a way for Mrs May to avoid another Commons reverse.
Former Cabinet minister Nicky Morgan, one of the rebels who helped inflict Mrs May's first Commons defeat on Wednesday, gave her support to the compromise over the Brexit date.
She said the new amendment "demonstrates how all Conservative MPs can work together" to deliver the best possible Brexit and reflects the flexibility within the Article 50 withdrawal process.
The amendment also emphasises that "Parliament will be fully involved in Brexit", she said.
But a senior Leave-supporting Tory said the rebels had now accepted that Government ministers are in control of setting the Brexit date.
"It is very reasonable for the Bill to mirror Article 50 more closely, but they have had to give up scrapping the date altogether and to accept that the Government remains in control of the date," the MP said.
In an apparent indication of the efforts to find a compromise, Tory Chief Whip Julian Smith sent a cryptic tweet of an image of a telephone with a reference to Prince Harry and Meghan Markle's wedding and the message "great news and great example - agreeing the date shouldn't be hard".
The progress in the domestic Brexit battle came hours after Mrs May received a boost in Brussels, with the 27 other EU countries formally agreeing to allow negotiations to proceed to their second phase.
The Prime Minister made clear she wanted talks on post-Brexit trade relations with the EU to begin "straight away", as the UK continues with its goal of negotiating a deal which can be signed immediately after the official date of departure..
Her target was described as "realistic" but "dramatically difficult" to achieve by the president of the European Council, Donald Tusk.
Mrs May was boosted by the terms of a statement agreed by the EU27 at the European Council summit in Brussels, which left the door open for "exploratory contacts" early in the New Year to allow Brussels to gain greater "clarity" on the UK's ambitions.
But the formal process is likely to run to a slower timetable, with official EU guidelines for trade talks not due to be approved until March 2018, when European Commission president Jean-Claude Juncker said the "real negotiations" would begin.
The EU27 confirmed Brussels' position that a final trade deal cannot be signed until the UK has formally left.
The four-page document also sets out the process for agreeing the terms of a transition period expected to last two years after the date of Brexit.
It makes clear that the EU expects the UK to observe all of its rules - including on freedom of movement - and accept the jurisdiction of the European Court of Justice during this time.
It also set up a potential clash with London over Mrs May's hopes of negotiating early trade agreements with countries outside the EU, stating firmly that the UK will stay in the single market and customs union during transition and will "continue to comply with EU trade policy", which bars deals by individual states.