US debt ceiling - what it is and why there is one
Days before the US government could start to run out of money, a tentative deal has been reached on raising the borrowing limit and saving the country from catastrophic default.
US President Joe Biden and Republican House Speaker Kevin McCarthy announced the news after weeks of high-stakes budget negotiations.
There are dire predictions of global financial chaos if US Congress can't agree on a deal to raise what is known as the debt ceiling.
This is how we got here and what it means.
So what is the debt ceiling?
Also known as the debt limit, this is a law that limits the total amount of money the government can borrow to pay its bills.
This includes paying for federal employees, the military, Social Security and Medicare, as well as interest on the national debt and tax refunds.
Every so often, US Congress votes to raise or suspend the ceiling so it can borrow more.
The cap currently stands at roughly $31.4tn (£25.2tn). That limit was breached in January, but the Treasury Department used "extraordinary measures" to provide the government with more cash while it figured out what to do.
Historically, it's a formality for Congress to raise the limit as needed, but in recent years, as the parties have become more polarised, they can't seem to agree on the terms.
Treasury Secretary Janet Yellen has warned that without more borrowing, the US will not have enough money to meet all of its financial obligations as soon as 5 June.
What's in the deal now proposed?
Last month, Republicans put forward a deal to keep spending for key agencies at 2022 levels during the next financial year - and limit growth to 1% annually over the next decade.
The proposal would have repealed key priorities of the Biden administration, such as student loan forgiveness and tax incentives for electric vehicles. They also wanted more work requirements for those receiving healthcare and food welfare.
They did not get all they wanted, but neither did Joe Biden's Democrats.
The deal means a freeze on non-defence budgets for 2024, followed by a 1% rise the following year and no budget caps after 2025.
What does Congress do now?
There will be a vote in the House and the Senate this week, perhaps as early as Wednesday.
Members of both political parties have expressed disquiet at the agreement.
On the right, some Republicans think it does not go far enough in curbing spending.
And on the other side, some Democrats are unhappy at the extra work requirements on some benefit recipients.
So it is not a guarantee that the bill will pass through Congress without a hitch.
What happens if the US defaults on its debt?
This has never happened before, so it is not entirely clear, but it would cause major economic damage.
The government would no longer be able to pay the salaries of federal and military employees, while Social Security cheques - payments that millions of pensioners in the US rely on - would stop. Companies and charities that count on government funds would be in peril.
If the government stops making interest payments on its debt, that would also put the country into default.
The US briefly entered default in 1979, which the Treasury blamed on an accidental cheque processing issue, but an intentional default would shock the financial system, where more than $500bn in US debt gets traded every day.
Moody's Analytics predicts that in a prolonged stand-off, stock prices would fall by almost a fifth and the economy would contract more than 4%, leading to the loss of more than seven million jobs.
Over the long term, if investors start to see US debt as risky, they will charge the US more to borrow money. And since government borrowing helps determine interest rates more widely, the impact would trickle out to the rest of the economy, making borrowing money for a home or a car more expensive for everyone.
There are debates about whether the government could prioritise interest payments to avoid a debt default. But honouring commitments to the owners of US debt, which include financial firms, pension funds and foreign investors, while retirees and others go unpaid, is seen as a difficult one to sell politically.
Why is the debt limit so divisive?
The debt limit debate highlights one of the fundamental ideological differences between the two major US political parties.
The Republicans view government spending sceptically. To them, rising national debt is evidence of out-of-control government.
While debt-limit brinkmanship is a relatively new strategy for the party, many Republicans believe it is necessary because the nation's current course will ultimately lead to economic and social ruin.
Democrats, on the whole, view national government power as a force for good - a means to improve American lives and right historical wrongs.
They see raising the debt limit when necessary as housekeeping needed to maintain the operation of the government.
The national debt, in their view, is simply a means to fund legislative programmes that have already been discussed and approved.
The debate dimmed when Donald Trump, a Republican, was in the White House and Congress raised the limit three times without major debate. It reignited when Joe Biden became president.