The 25th Amendment to the U.S. Constitution deals with presidential authority in the event of death or removal from office, and was ratified in 1967, in the wake of John F Kennedy's assassination.

What does the 25th Amendment say?

It is in four sections, all dealing with the president leaving office during his or her elected term.

The first section states that the vice president takes over the Oval Office if the president dies or resigns – or is removed – something which the original Constitution did not clearly state.

Presidents of course can be removed by impeachment, a feature of the constitution from the start. They can also be removed through the 25th Amendment - of which more below.

Section II states that if the vice president dies, or resigns – or is fired – both the House and Senate have to confirm a new vice president. Until 1967, presidents could change vice presidents mid-term on their own if they got the vice president to agree to resign - not something that actually happened, but which was possible in principle.

Section III makes clear that the a president can temporarily delegate his powers to the vice president, and later reclaim them when he - or she - is capable of serving. This is most often invoked if a president is under the influence of surgical anesthetic for a short period of time.

Section IV is the amendment's most controversial part: it describes how the president can be removed from office if he is incapacitated and does not leave on his own.

The vice president and 'a majority of either the principal officers of the executive departments or of such other body as Congress may by law provide' must write to both the president pro tempore of the Senate and the Speaker of the House, saying that 'the President is unable to discharge the powers and duties of his office.'

The term principal officers of the executive departments would normally mean the cabinet secretaries.

So at least eight of the president's 15 most senior Cabinet members together with the vice president must agree that a president should be removed before any plan can move forward.

Notifying the House Speaker and the Senate president pro tempore is the act that immediately elevates the vice president to an 'acting president' role.

The deposed president can contest the claim, giving the leaders of the bloodless coup four days to re-assert their claims to the House and Senate.

Congress then has two days to convene – unless it is already in session – and another 21 days to vote on whether the president is incapable of serving. A two-thirds majority in both houses is required to make that determination.

As soon as there is a vote with a two-thirds majority, the president loses his powers and is removed, and the vice president stops acting and is sworn in as president.

But if 21 days of debate and votes ends without a two-thirds majority, the president gets back his powers.

What could happen to trigger the 25th Amendment?

Vice President Mike Pence and eight of the 15 'principal' Cabinet members would have to agree to notify Congress that President Donald Trump was incapable of running the country.

That group is made up of the Secretary of State, Treasury Secretary Steve Mnuchin, Secretary of Defense , Attorney General, Interior Secretary, Agriculture Secretary, Commerce Secretary, Labor Secretary, Health and Human Services Secretary, Transportation Secretary, Energy Secretary , Education Secretary, Veterans Affairs Secretary and Homeland Security Secretary.

Their formal notification would go to the House Speaker and, in the senate, to the 'president pro tempore', the Senate's most senior member. As soon as the letter is sent, Pence would become 'acting president.'

Alternatively, Congress could set up its own mechanism to decide if he is fit for office - maybe a commission, or a joint committee. Pence would still have to agree with its conclusion and then write formally to the Speaker and president pro tempore.

Or another possibility is that the pool of 'principal officers' is considered to be bigger than the 15 and a majority of that group call Trump incapable.

What if Trump does not agree?

If Trump claims he is capable of holding office, he would write to the House Speaker and the president pro tempore of the Senate within four days, setting up three weeks of intense debate in both houses of Congress.

Trump would be removed from office if both two-thirds majorities in both the House and Senate agreed with Pence and his cabal.

If either of both chambers fell short of that mark, Trump would retain his powers and likely embark on a wholesale housecleaning, firing Pence and replacing disloyal Cabinet members.

Are there any loopholes?

The 25th Amendment allows Congress to appoint its own panel to evaluate the president instead of relying on the Cabinet – the men and women who work most closely with Trump – to decide on a course of action.

It specifies that some 'other body as Congress may by law provide' could play that role, but Pence would still need to agree with any finding that the president is incapable of discharging his duties.

If Democrats were to take over both the House and Senate, they could create such a panel with simple majority votes.

That commission could hypothetically include anyone from presidential historians to psychiatrists, entrusted to assess the president's fitness for office.

Another loophole is that it does not spell out that the Cabinet is needed to agree, but says that the 'principal officers' of the departments are needed. That term is undefined in the constitution. In some departments legislation appears to name not just the secretary but deputies and even undersecretaries as 'principal officers', so many more people could be called in to the assessment of Trump's fitness.

Could Trump fire Pence if he rebelled?

Yes, in principle. If Trump smelled a whiff of trouble – if Pence and a cabal of Cabinet members, or Pence and a panel assembled by Congress seemed ready to judge him incapacitated – he could dismiss his vice president with the stroke of a pen to stop the process.

But installing a more loyal VP could be problematic since the 25th Amendment includes its own poison pill: Both houses of Congress must vote to approve a new vice president.

That means Trump would find himself up against the same Congress that would vote on his fitness for office, unless the process were to unfold in the weeks before a new Congress.

Theoretically, a Democratic-controlled Congress could make life dramatically more difficult for the president if it came into power in the midst of the constitutional crisis.

One scenario has appeared to stump presidential historians, however: Firing Pence before the process is underway, and then leaving the vice presidency vacant, would give Congress no practical way forward. That would present its own constitutional crisis.

Is there any precedent for this?

No. Only Section III, the voluntary surrender of presidential powers, has ever been used - and only very briefly.

In December 1978, President Jimmy Carter thought about invoking Section III when he was contemplating a surgical procedure to remove hemorrhoids.

Presidents Ronald Reagan and George W. Bush both voluntarily relinquished their powers while undergoing procedures under anesthetic.

Section IV has also never been invoked, although there have been claims that Ronald Reagan's chief of staff Donald Regan told his successor, Howard Baker, in 1987 that he should be prepared to invoke it because Reagan was inattentive and inept.

The PBS documentary 'American Experience' recounts how Baker and his team watched Reagan closely for signs of incapacity during their first meeting and decided he was in perfect command of himself.