Image copyright Getty Images

Outside observers could be forgiven for being a little mystified at news that the US government has shut down. So what is going on and how did we get here?

What is a shutdown?

It's when parts of the US government close until the government can decide on spending plans.

Many federal agencies close down, so that potentially hundreds of thousands of government employees have to take a leave of absence, often without pay.

Services such as national security, electricity generation and air traffic control continue, but others considered non-essential, like visa and passport processing, could be delayed.

US Defence Secretary Jim Mattis said that over 50% of his department would not go to work, and some of the military's maintenance, training and intelligence operations would come to a halt.

The Trump administration said it planned to keep national parks open. When they closed during the 2013 shutdown there was an angry public reaction.

Why did this happen?

A spending bill - called an appropriations bill in US political parlance - had to be passed by Congress and signed by President Donald Trump by midnight on Friday 19 January.

This did not happen, and without an agreement on spending the federal government effectively closes its doors.

Whose fault was it?

As ever in politics, that depends on your point of view.

Republicans are labelling it the Schumer shutdown, blaming Senate minority leader Chuck Schumer, who led the Democrats to block the bill.

But Democrats say they had a deal on immigration - a major sticking point - before the president backed out.

Correspondents say the winner of the blame game has yet to be decided, but the Republicans are going into the fight with lower popularity.

Haven't we been here before?

Yes. The US government has closed for business several times before. The most recent shutdown lasted 16 days in 2013, when Republicans demanded the spending bill have provisions to impede or delay President Barack Obama's Affordable Care Act.

National monuments and parks were closed and hundreds of thousands of government workers put on unpaid leave. Only one person was left to patrol the 5,525 mile (8,891km) border with Canada.

But this is the first time since 1980 that a budget impasse has led to a shutdown when both chambers of Congress and the White House are controlled by the same party - the Republicans.

Who put the bill together?

Hopes for a long-term spending bill, funding the US government for the entire 2018 budget year that ends in October, have long since vanished.

The measure that failed to pass on Friday evening would have kept Washington running until 16 February, and then the whole showdown would have resumed all over again.

It was crafted by the Republican leadership in the House of Representatives and the Senate and included a few sweeteners to make it easier to vote for (and more difficult to vote against).

Several unpopular healthcare taxes were suspended in this bill.

They also offered full re-authorisation for six years of the Children's Health Insurance Programme (Chip), which provides coverage for low-income families but is on the verge of running out of funds.

But these sweeteners were not sweet enough, and the bill failed to pass.

Wasn't everything looking good for it to pass?

On Wednesday the Republican game plan seemed clear.

Pass the temporary funding, with the sweeteners, over unanimous Democratic opposition in the House of Representatives. Then essentially dare Democrats to block the bill in the Senate, denying money for poor children and forcing a shutdown.

The ground beneath the party began to crack on Thursday, however.

The president tweeted that he didn't support the inclusion of Chip funding in the stopgap bill, forcing a White House scramble to explain that Mr Trump still backed the legislation.

The House of Representatives passed the bill, but a handful of Republicans in the Senate said they would vote no.

And the Senate Democrats announced they had enough votes on their own to block passage.

Ultimately, the bill failed by a margin of 50-49, well short of the 60 votes required.

Any other sticking points?

Take your pick:

a comprehensive immigration deal that includes Daca protections (for Democrats)

border security, immigration reform and funding for a border wall (for Mr Trump)

increasing military spending (for defence hawks)

The presences (or absence) of any of the above could all have been reasons for legislators to go from yes to no.

So what happens next?

Mr Trump has called for a "nuclear option" of lowering the number of votes required to pass. An absolute majority (51%) would be easier for the Republicans to reach than the current 60% threshold.

This would need to be led by Mr McConnell, but he has said he and other Republicans are opposed to it.

Skip Twitter post by @realDonaldTrump Great to see how hard Republicans are fighting for our Military and Safety at the Border. The Dems just want illegal immigrants to pour into our nation unchecked. If stalemate continues, Republicans should go to 51% (Nuclear Option) and vote on real, long term budget, no C.R.’s! — Donald J. Trump (@realDonaldTrump) January 21, 2018 Report

A bipartisan group of 20 senators has met to try and reach a compromise, and some sound optimistic ahead of a vote due to be held on Monday.

Read more on Trump's first year