The top 'AAA' long-term debt rating of the United States will be in danger if lawmakers do not raise borrowing limits in a timely fashion, ratings agency Fitch has warned.

Congress faces looming deadlines to approve spending for 2018 and raise legal limits on the amount the United States can borrow in order to meet immediate funding obligations - raising the prospect that the US could default on its sovereign debt for the first time ever and cause havoc on global markets.

The non-partisan Congressional Budget Office estimates that the US Treasury has until October before exhausting the "extraordinary measures" it put in place in March, when the US reached its current $19.8 trillion borrowing limit.

Lawmakers return from August recess on 5 September, making the window for action even tighter.

"If the debt limit is not raised in a timely manner prior to the so-called 'x date,' Fitch would review the US sovereign rating, with potentially negative implications," the agency said in a statement.

The ratings agency Standard & Poor's in 2011 downgraded the US debt rating to AA+, a notch below its highest level, following battles among lawmakers over whether to lift the cap on borrowing.

In the event the limit is not raised, prioritizing some payments over others, as some have suggested Washington may be forced to do, "may not be compatible with 'AAA' status," Fitch said.

The Trump administration has called on lawmakers to raise the debt limit "as soon as possible."

Failure to adopt spending legislation, resulting in a government shutdown, would not directly affect the US debt rating, "but it would highlight how political divisions pose challenges to the budgetary process," Fitch said.

President Donald Trump's insistence that Congress fund his proposed wall along the Mexican border, a key campaign pledge, could upset delicate negotiations on Capitol Hill.

Speaking in Phoenix, Arizona yesterday, Mr Trump threatened a government shutdown if Democrats continued to oppose the plan.

"Believe me, if we have to close down our government, we're building that wall," he said.