Departing the European Union is possible, but there are no precedents for it. Article 50 of the bloc's Lisbon Treaty sets out the procedure, which Britain is expected to follow in the wake of last week's referendum.
It says that "any member state may decide to withdraw from the union in accordance with its own constitutional requirements," and should kick-start the process by notifying EU governments "of its intention."
The leave agreement would not require separate approval by individual EU member states. However, unanimity at EU level, and national ratification votes, would be required to approve a free trade pact or any other deal Britain strikes with the bloc as an independent state.
Remaining EU members should negotiate an agreement with the departing state "setting arrangements for its withdrawal, taking account of the framework for its future relationship with the union."
The deal requires the approval of a qualified majority of EU states, after the consent of the European Parliament.
If an exit agreement cannot be reached within two years, the departing member is kicked out of the EU automatically, unless the country and remaining EU member states unanimously decide to postpone that deadline.
Several existing relationships between the EU and other nearby countries have been floated as models, including those of Norway and Switzerland. They have to comply with at least some EU rules and chip into its budget in return for having access to its single market.