Theresa May is standing down as leader of the Conservative Party and soon there will be a new prime minister. What is going to happen with Brexit?
After the UK and the EU agreed a second delay to Brexit, it is due to happen on 31 October. Cross-party talks between the government and Labour to try to find a compromise ended without an agreement.
Theresa May repeatedly lost votes in the House of Commons on her deal.
Now a new Conservative leader will be chosen and will become prime minister. The plan is that the process should be concluded before the summer recess - the moment in late July when Parliament takes a break. What happens next on Brexit will depend on who wins.
Some leadership candidates have suggested they're comfortable with a no-deal Brexit - leaving the European Union without a formal agreement in place.
Others have said they'll seek to renegotiate the deal or at least to agree amendments with the EU.
It has also been suggested that the only way out of the impasse could be a new public vote - either a general election or a referendum.
And there could yet be a further delay.
1. No deal
No-deal Brexit is still the default outcome if MPs can't agree anything else and there are no further extensions. The deadline is 31 October.
It would also be possible for MPs to back a no-deal Brexit although there has been a majority against that option when they have voted on it before.
There's been considerable discussion about whether MPs would be able to stop no deal if the new prime minister were determined to press ahead.
It's true that the new PM could try to avoid binding votes in the House of Commons but the Speaker, John Bercow, has made it clear that he will enable attempts by MPs to have their say.
And ultimately the prime minister can be ousted if they lose a confidence vote.
2. Renegotiation
The new prime minister could choose to try to negotiate a new Brexit deal.
Some of the alternative proposals put forward by the leadership candidates would require changing the withdrawal agreement - the legally binding part of the Brexit deal that covers exit terms - including money, the transition period, citizens' rights and the border between Northern Ireland and the Republic.
However, the EU has so far said it is not prepared to re-open this part of the deal.
The alternative would be changes to the political declaration - the part that outlines plans for the long-term future relationship between the UK and EU.
The potential difficulty with that approach is that it might not be enough to convert the critics who repeatedly voted against Theresa May's deal.
Also, there is very little time for renegotiation between now and 31 October. Parliament in the UK is away for the whole of August, not returning until September. Parliament again goes into recess in the middle of September for the party conference season.
Nothing much is usually done in Brussels during August and much attention will be focused on the picking of the new European Commission which takes office on 1 November.
3. Another referendum
A further possibility is to hold another referendum.
It could have the same status as the 2016 referendum, which was legally non-binding and advisory. But some MPs want to hold a binding referendum where the result would automatically take effect - like with the 2011 referendum on changing the voting system for UK general elections.
One widely discussed option would be for a "confirmatory vote" on whatever deal is finally agreed where the public would be given the choice between accepting the existing deal (or an alternative plan) and remaining in the EU.
Others argue that any further referendum should have the option of leaving the EU without a deal.
Either way, a referendum can't just happen automatically. The rules for referendums are set out in a law called the Political Parties, Elections and Referendums Act 2000.
There would have to be a new piece of legislation to make a referendum happen and to determine the rules, such as who would be allowed to vote.
It couldn't be rushed through, because there has to be time for the Electoral Commission to consider and advise on the referendum question.
The question is then defined in the legislation.
Once the legislation has been passed, the referendum couldn't happen immediately either. There would have to be a statutory "referendum period" before the vote takes place.
Experts at University College London's Constitution Unit suggest that the minimum time for all of the required steps above is about 22 weeks. That already takes us beyond 31 October.
4. Call a general election
The new prime minister could decide the best way out of the deadlock would be to hold an early general election.
They won't have the power just to call an election. But, as in 2017, they could ask MPs to vote for an early election under the terms of the Fixed Term Parliaments Act.
Two-thirds of all MPs would need to support the move. The earliest date for the election would be 25 working days later but it could be after that - the prime minister would choose the precise date.
5. Another no-confidence vote
Theresa May's government survived a vote of no confidence on 16 January by 325 votes to 306. Labour could table a no confidence motion in the new government at any time.
Under the Fixed Term Parliaments Act 2011, UK general elections are only supposed to happen every five years. The next one is due in 2022.
But a vote of no confidence lets MPs vote on whether they want the government to continue. The motion must be worded: "That this House has no confidence in Her Majesty's Government."
If a majority of MPs vote for the motion then it starts a 14-day countdown.
If during that time the current government or any other alternative government cannot win a new vote of confidence, then an early general election would be called.
That election cannot happen for at least 25 working days.
6. Cancel Brexit
The European Court of Justice has ruled that it would be legal for the UK to unilaterally revoke Article 50 to cancel Brexit (without the need for agreement from the other 27 EU countries).
It's not totally clear what the process would be. But an act of Parliament calling for Article 50 to be revoked would probably be sufficient.
None of the Conservative leadership contenders has suggested this would be their policy but it could still be the ultimate outcome - possibly after one of the other options has been tried.
7. Return of the existing deal
Although Theresa May will be out of Number 10, there's still a possibility that the deal she negotiated with the EU could end up being the blueprint for Brexit.
If MPs can't agree on anything else some MPs who previously voted against the existing deal could switch sides to prevent no deal or no Brexit.
8. Further delay
There's no legal obstacle to a further delay. The new government could ask for additional time - perhaps to hold another vote or to allow more preparations for a no-deal Brexit.
It's not clear whether the EU would agree. It would have to be approved unanimously by all the other member states.
https://www.bbc.com/news/uk-politics-46393399