BRUSSELS (Reuters) - The Spanish prime minister’s threats to block a Brexit deal this week over Madrid’s claims to Britain’s tiny territory of Gibraltar on the Spanish coast has raised questions of veto risks for the package.

FILE PHOTO: An anti-Brexit protester waves a flag opposite the Houses of Parliament in London, Britain, October 9, 2018. REUTERS/Simon Dawson

Here is where the dangers lie, and why they are limited:

WITHDRAWAL AGREEMENT

This treaty between the EU sets terms for Britain’s exit on March 29, including a 21-month status quo transition period. A text was agreed by EU negotiators and British Prime Minister Theresa May’s government last week. The European Council of the 27 national leaders is due to give its political endorsement at a Brussels summit on Sunday at 10 a.m. (0900 GMT) before holding a meeting with May to demonstrate the commitment of both sides.

Were Spain or any other government to break ranks and refuse to endorse the text on Sunday, the process would be held up by that lack of consensus and further negotiation might be needed. However, EU officials to not believe that is at all likely.

In part, that is because all governments will have had the chance to resolve problems during meetings of their envoys in Brussels and a meeting on Friday among leaders’ “sherpa” aides.

After the summit, May will submit the treaty to a vote in the British parliament. Passage there is uncertain.

Once the Council gives its consensus endorsement, the treaty will go to the European Parliament. It is unlikely to withhold consent but will not decide until its British counterpart votes.

To become law, the treaty must return to the Council. Under Treaty Article 50, it could be voted down if at least eight states, representing 35 percent of the EU population, object. In reality, approval should be a rubber-stamp process by March.

POLITICAL DECLARATION

Alongside the 585-page exit treaty, leaders are due to give their political approval to 20 or so pages of a declaration of intent on their future relationship with Britain. May is due to meet EU chief executive Jean-Claude Juncker later on Wednesday and diplomats hope that can finalize a text to be approved by EU national envoys on Thursday and leaders’ sherpas on Friday.

The declaration will lay out ambitions for a deep free trade deal and close cooperation on security and world affairs.

As with the treaty, anyone might break consensus but this is unlikely. Officials should ensure that leaders have a text they can approve in what is planned as a brief one-hour summit.

The European Parliament will consider its consent to the treaty alongside consideration of the political declaration.

FUTURE TREATY

Once Britain has left, the two sides will start negotiating a new relationship on the basis of the political declaration, in the hope of having something ready by the time the transition ends.

The other 27 member states have been pitching contradictory national demands for the future with Britain. EU officials expect divisive issues to be put to one side to reach consensus on the declaration. These will then play into a mandate which the Council of member states gives to Juncker’s negotiators, who aim to hammer out a treaty with Britain that all 27 will accept.

Once the European Commission has negotiated the treaty, it will bring it back to the Council which again will have to give is consensual political endorsement. Consultation with states during the negotiations should limit last-minute blow-ups.

PARLIAMENTARY RATIFICATION

Once the future treaty is endorsed by the Council, it must get the European Parliament’s consent. If a treaty encroaches on areas beyond Brussels’ remit and into “national competences” -- investment rules, for example -- it will also need ratification by lawmakers in all 27 EU states, a potential stumbling block. For that reason, the two sides could decide to negotiate two or more treaties, limiting the number that need wider ratification.