Brexit - As 'leave' vote wins, what will happen next in Britain's relations with the European Union?
What does it all mean?
The European Union is in shock and entering uncharted territory. No member state has ever left and Article 50 of the EU treaty, which sets out how a state can exit the bloc, offers little detail. Although it provides a sketchy legal framework for a two-year period of withdrawal (see below), many fear the process can quickly become acrimonious, disrupting the economy and European affairs across the board.
Look back at the vote results
Prime Minister David Cameron has said he will notify the union "immediately" that Britain is leaving by invoking Article 50. But it is not clear how quickly Britain will set that two-year clock ticking and the EU itself cannot, officials believe, trigger the process itself.
Having lost, Mr Cameron faces huge pressure from his divided Conservative party to resign, although he should remain premier until the party elects a successor. Pro-Brexit potential successors may try to prevent him launching the departure process right away. EU leaders have hoped Mr Cameron might deliver formal notice when they meet him at a summit on Tuesday but many seem willing to give Britain several weeks to get organised.
Some Brexit campaigners have suggested Britain should wait before triggering Article 50 to give more time for negotiation, possibly even to win better EU membership terms or to secure a deal to retain British access to EU markets once it has left.
EU leaders have ruled out further talks on membership - "Leave means leave," they say - and many want a quick, two-year divorce while negotiating terms for a future, arms-length relationship may take much longer. However, major EU powers appear keen to see as orderly a transition as possible to a new relationship. That could involve Article 50 negotiations being extended beyond two years to allow time for a broader deal. But such an extension requires the consent of all 28 member states, and reaching that unanimity could be problematic.
A deal Mr Cameron struck with EU leaders in February to curb immigration, protect London finance interests from the euro zone and opt out of "ever closer union" is killed by the referendum.
If no treaty is agreed, EU law simply ceases to apply to Britain two years after it gives formal notice it is leaving.
Until a departure treaty is signed - which requires assent from Britain and a majority of the remaining 27 states weighted by population - Britain remains, in principle, a full member of the EU but will be excluded from discussions affecting its exit terms. In practice, many expect British ministers and lawmakers to be rapidly frozen out of much of the union's affairs.
Some Brexit campaigners have also said Britain should act more quickly, for example to stop funding the EU budget or curb immigration from EU states. That could provoke EU reprisals.
"The Article 50 process is a divorce: who gets the house, who gets the kids, who gets the bank accounts," a senior EU official said, referring to priorities such as settling the EU budget and the status of Britons living in other EU states and of EU citizens in Britain - several million people in total.
Failing to stick to Article 50 would be "messy divorce territory", the official told Reuters: "It is spouses, instead of working through lawyers, throwing dishes at each other."
An array of laws and EU entitlements will cease to apply to British business and citizens, creating what Brexit campaigners say will be opportunities for more growth and more selective immigration but which Mr Cameron has said will do long-term damage to the economy and Britain's global influence.
New trade barriers would hurt both sides' economies. But the EU fears a political "domino effect" would cost more long-term.
What's happening right now?
European Parliament leaders meet immediately.
European Council President Donald Tusk, who will chair the summit next week and has spoken to all the leaders in the days before the vote, will deliver a statement in the name of the council, the EU's governing body, once the result is official.
European Commission President Jean-Claude Juncker, the EU chief executive, hosts Tusk and European Parliament President Martin Schulz at his Berlaymont headquarters in Brussels. Also present will be Dutch Prime Minister Mark Rutte, whose government holds the rotating EU presidency.
Look for a mantra of Three Rs: Regret - at losing nearly a fifth of the EU economy and more of its military and global clout; Respect - for the will of the British people; and Resolve - to keep the rest of the union together. Leaders will also remind Britain that it remains a full member for the time being.
EU leaders meet in Brussels for a 24-hour summit starting at 5 pm on Tuesday. EU officials expect Mr Cameron to report on the vote and what Britain will do next, then go home that evening.
What is Article 50?
This 261-word section of the Lisbon Treaty has the following key phrases:
Where does the EU go from here?
The union needs quickly to fill a 7 billion euro hole in its 145 billion euro annual budget, which is currently fixed out to 2020, as it loses Britain's contributions while saving on what Britons receive from EU accounts.
The EU will also want to clarify as quickly as possible the status of firms and individuals currently using their EU rights to trade, work and live on either side of a new UK-EU frontier.
Britain is likely give up its six-month presidency of EU ministerial councils, due to start in July next year. Its place may be filled by Estonia or, possibly Malta or Croatia.
EU leaders may push for a quick show of unity on holding the bloc together in the face of eurosceptics inspired by the result in Britain - including National Front leader Marine Le Pen, who leads polls for next April's French presidential election.
Divisions between Berlin and Paris on managing the euro zone probably rule out a big move on that front before both hold elections in 2017. Closer EU defence cooperation, without sceptical Britain, may be revived. A major EU security policy review is already on the summit agenda as is a new push to tighten control on irregular immigration from Africa.
Many leaders caution against alienating voters by moving too fast on integration, which they say has alienated voters. Mr Tusk wants to launch a formal process of reflection on where the union has failed to connect with people.
So, what changes?
In principle, nothing changes immediately. Britons remain EU citizens and business continues as before. In practice, many believe trade, investment and political decisions will quickly anticipate British departure from the bloc. The EU could also face a Britain breaking apart if europhile Scots make another push for independence and seek to join the EU on their own.
There is a "Brussels consensus" that Britain must be made an example of for leaving and will face a chilly future, cast out to perhaps talk its way back later into some kind of trade access in return for concessions such as free migration from inside the bloc and contributions to the EU budget - things which Brexit voters want to end but which the likes of Norway and Switzerland have accepted in varying forms.
However, cautious diplomats do not rule out surprise turns.