Image source, Getty ImagesImage caption, Republican Senate Minority leader Mitch McConnell said Republicans and Democrats negotiated through the night "in good faith"

Senators in the United States have agreed to extend the country's debt ceiling, less than two weeks before it was due to be reached.

A debt ceiling is a limit on how much the government can borrow.

There were fears that the US would default on its national debt, with catastrophic financial implications.

But Senate Majority leader Chuck Schumer said Congress had reached a deal to extend the debt ceiling until early December.

Republican Senate Minority leader Mitch McConnell said: "Republican and Democratic members and staff negotiated through the night in good faith."

The temporary debt compromise will need to be passed by both chambers of Congress.

Congress will still have to address this issue near the new December deadline to avert a default, creating a headache right around the holidays.

  • Is the US about to overshoot its debt limit?

The agreement comes less than two weeks before 18 October, the day the US Treasury Secretary Janet Yellen warned was the deadline to prevent the first ever US default.

The US debt currently stands at around $28tn (£21tn).

Failure by the US to repay its bill would severely hurt the country's credit rating, plunge the global financial system into turmoil, and possibly lead to a self-inflicted recession.

What is the debt ceiling?

The US government spends more money than it collects in taxes, so it borrows to make up for the shortfall.

Borrowing is done via the US Treasury, through the issuing of bonds. US government bonds are seen as among the world's safest and most reliable investments.

In 1939, Congress established an aggregate limit or "ceiling" on how much debt the government can accumulate.

The ceiling has been lifted on more than 100 occasions to allow the government to borrow more. Congress often acts on it in a bipartisan manner and it is rarely the subject of a political standoff.

But some Republicans have voiced frustration around new spending proposals that Democrats are trying to push through without Republican support.

Democrats have pointed out that raising the debt ceiling is about paying off existing obligations rather than paying for new ones, and that President Joe Biden's policies have only contributed to 3% of existing debts.