(Reuters) - British Prime Minister Theresa May’s cabinet on Wednesday approved a draft Brexit deal with the European Union, more than 500 pages of legal text that was long held up by disagreements between the two sides on the Irish border.

While both the UK and the EU have said they were determined to avoid reintroducing extensive border controls between EU state Ireland and Britain’s province of Northern Ireland after Brexit, they differed bitterly on how to achieve that.

The Irish border will become the only land frontier between the EU and the United Kingdom after Brexit but any return of extensive controls there is seen as endangering peace on the island that has seen decades of sectarian violence.

The following is what the sides finally agreed on in that regard, much to the dismay of Brexiteers in the UK, as well as the Northern Irish unionist party that props up May’s government.

Their opposition to the agreement means it is far from clear whether it would pass in the UK parliament, which is necessary for the agreement to take effect.

- The emergency fix to ensure no return of a hard border on the island of Ireland - or the “backstop” - would be part of Britain’s withdrawal agreement from the EU, the main legally binding document settling Brexit between the two sides.

- It will remain in place “temporarily” or “unless and until” a new trade deal between the EU and the UK - to be negotiated after Brexit - takes effect and maintains the current open border. The sides will seek to get the new deal by the end of 2020.

- Britain will get a status quo transition after Brexit until the end of 2020, with an option to extend it once. Britain can request extension before July 1, 2020, and it would be decided on jointly by the UK and the EU.

- If the new EU-UK trade deal is not ready by the end of the transition period, the backstop kicks in and creates a single EU-UK customs territory.

- Northern Ireland will be part of the same customs territory as the rest of the UK with no tariffs, quotas and checks on rules of origin between the province and Great Britain.

- Fisheries are exempted from the EU-UK customs zone and agreements on access to fishing waters will only be negotiated during the transition period after Brexit to form part of the new EU-UK relationship.

- Northern Ireland will be more closely aligned with EU customs rules than the rest of the UK, allowing Northern Irish goods to enter the bloc’s single market as they do now.

Northern Ireland will remain bound by the EU’s laws on VAT and excise taxes, standards on goods, sanitary and veterinary controls, agriculture and state aid. The EU’s customs code will continue to apply in Northern Ireland.

- The UK commits to ensuring the so-called level playing field if the backstop is triggered, meaning it would adhere to EU rules on state aid and competition, taxes, environment and labor rules. The sides agree they would not lower the bloc’s current standards in these fields after Brexit.

This is to ensure that Britain would not sell its products on the EU market at much lower prices as a result of undercutting standards.

- The EU and UK would only be able to decide jointly on nullifying the backstop. This means they have to be in agreement that it is no longer necessary in order to maintain the open Irish border.

- Under the single customs territory that kicks in if the backstop is activated, the UK would apply the same external tariffs on goods as the EU and respect the bloc’s rules of origin, or protection of some special products from designated locations, such as camembert cheese.

- While this backstop customs arrangement is meant to be temporary, it will form the basis on which arrangements in the future relationship between the EU and the UK are built.

- This agreement would ensure there would be no checks of goods and people crossing between Northern Ireland and Ireland. Their common travel area and single electricity market is preserved, as is the 1998 Good Friday Agreement that ended violence on the island.

- There would be some checks on goods crossing from Great Britain to Northern Ireland to ensure compliance with EU standards. They would mostly take place in the market or at traders’ premises and be carried out by UK authorities. EU representatives would have the right to be present.

Existing checks on agricultural and animal products between Northern Ireland and Great Britain at ports and airport would be stepped up.

- The European Union’s top court, the European Court of Justice, would remain the ultimate arbiter for “issues related to EU law concepts outlined in the Withdrawal Agreement”.