Media playback is unsupported on your device Media caption Brexit: What happens next?

It was an evening of high-stakes and unprecedented drama that will have an impact far beyond the UK.

Prime Minister Theresa May's plan for leaving the European Union - the only one on the table - was voted down by parliament on Tuesday.

And, given the constant stream of analysis and speculation, you could be forgiven for feeling a little overwhelmed by it all.

So let's break it down...

What was the vote about?

Politicians were voting on the deal Mrs May struck with the European Union after more than two years of negotiations.

It set out a plan for how the UK would leave the EU on 29 March.

This deal covered some hugely important issues such as what will happen to UK citizens living in the EU and how much money the UK will have to pay to leave.

If it had passed then it would have come into force on 29 March, only 73 days later. Simple enough - at least by the standards of Brexit.

But one thing we have learned by now is that the course of Brexit rarely runs smooth...

Please upgrade your browser Your guide to Brexit jargon Enter the word or phrase you are looking for Search

What happened?

It was the kind of result that Mrs May will have had nightmares about.

Members of Parliament (MPs) voted by an overwhelming margin of 230 votes to reject her deal.

Of those, 118 were from Mrs May's own Conservative party.

It was the largest defeat for a sitting government in history and showed just how unpopular the deal was.

Media playback is unsupported on your device Media caption Confused by Brexit jargon? Reality Check unpacks the basics.

The most controversial sticking point was the issue of the so-called backstop.

This is a kind of safety net designed to avoid physical border checks between Northern Ireland, which is part of the UK, and the Republic of Ireland, which is a member of the EU.

Why does it matter?

The defeat is a massive blow for Mrs May and throws yet more doubt on the Brexit process. The date for Brexit is only two and a bit months away, but the UK doesn't appear to be any closer to agreeing how exactly it will leave the EU.

Ordinarily, such a crushing defeat would be followed by the prime minister's resignation.

But, it's fair to say, these are anything but ordinary times.

What comes next?

The leader of the opposition, Jeremy Corbyn, has tabled what's known as a vote of no confidence in the government.

This lets MPs decide on whether they want the government to continue.

It will be held on Wednesday evening and, if parliament decides that it does not want the government to carry on, then it could trigger a general election.

If, as many analysts predict, Mrs May survives the vote then she says she will present parliament with a different Brexit plan on Monday.

But at this stage, there's no sense at all what another plan would look like.

If parliament doesn't change its mind then there are a few different possibilities.

If nothing else happens it will be a no-deal Brexit, This means - as you might expect - the UK leaving on 29 March without a formal agreement.

This would mean no transition period and a sudden rupture in UK/EU relations.

Quick guide: What is a no-deal Brexit? A "no-deal" Brexit is where the UK would cut ties with the European Union overnight without a transition period. Theresa May's government, and many others, believe this would be hugely damaging and want a more gradual withdrawal. But if Parliament can't agree on that, and nothing else takes its place, the UK could still leave without a deal. This would mean the UK would not have to obey EU rules. Instead, it would need to follow World Trade Organization terms on trade. Many businesses would see new taxes on imports, exports and services, which are likely to increase their operating costs. That means the prices of some goods in UK shops could go up. The UK would also lose the trade agreements it had with other countries as a member of the EU, all of which would need to be renegotiated alongside the new agreement with the EU itself. Manufacturers in the UK expect to face delays in components coming across the border. The UK would be free to set its own immigration controls. However some UK professionals working in the EU and UK expats could face uncertainty. Some countries, such as Spain, Germany and the Netherlands, have given temporary guarantees about residency status and rights, but there is not yet an agreed policy for UK citizens across the EU in the event of a no-deal Brexit. The situation for holidays and business trips is a little clearer, as the European Commission has said that even in a no-deal scenario, UK travellers won't need a visa for short visits of up to 90 days. The border between Northern Ireland and the Irish republic would become an external frontier for the EU with customs and immigration controls, though how and where any checks would be made is not clear. Some Leave supporters think that leaving without a deal would be positive if the right preparations were made. They say criticism is scaremongering and any short term pain would be for long term gain. But critics - including both Brexit supporters and opponents - say that leaving without a deal would be a disaster for the UK: driving up food prices, leading to shortages of goods and gridlock on some roads in the South East resulting from extra border checks.

The government could also propose to negotiate a brand new deal, although this may mean asking for some extra time from the EU.

There could also be another referendum, which would also likely mean asking for more time, or Mrs May could decide that a general election is the best way to end the stalemate.

Either way, the UK is in uncharted territory and the Brexit clock is ticking.