Withdrawal
A member state can withdraw from the European Union on its own decision according to Art. 50 TEU in the Lisbon Treaty. The deal on withdrawal is decided by qualified majority in the Council and approval by the European Parliament.
After 2 years a member state may withdraw with no agreement.
Today withdrawal is possible according to international law. The EU require formally unanimity to allow a country to withdraw.
In 1984 Greenland withdraw from the EU after unanimous agreement.

