(Reuters) - President Donald Trump said on Tuesday he was willing to shut down the government to get funding for a U.S.-Mexico border wall, complicating two must-pass measures Congress will take up in September: a spending package and raising the debt ceiling. Here is what you need to know about both, and the potential for a shutdown of the U.S. government: Congress must pass annual spending bills around the end of the federal fiscal year on Sept. 30 to fund much of the U.S. government. When disagreements prevent that, which is frequent, lawmakers often pass a temporary bill extending existing spending levels with no changes for days, weeks or months, while they work on a longer-lasting deal. When they cannot agree on either a new spending plan or a short-term extension, the government shuts down. That has happened many times since the 1970s, usually for a few days, and can rattle markets. Congress will return from its long summer recess on Sept. 5. At the time, it will have only about 12 working days to approve spending measures to keep the government open. If spending measures are not passed before Oct. 1, portions of the government will begin to shut down and non-essential employees will go without pay until an agreement is reached. The government most recently shut down for about two weeks in October 2013 over funding for former President Barack Obama’s healthcare law. There were three shutdowns in the 1990s, the longest lasting 21 days. In the 1970s and 1980s, there were 14 shutdowns, some partial and most lasting only a few days. The “debt ceiling” is a legislative limit on how much money the federal government can borrow through debt issued by the U.S. Treasury. Once the limit is reached, Congress must raise it or the government cannot continue borrowing money and would default, or be unable to pay its bills. The Treasury has said it wants Congress to increase the debt ceiling by Sept. 29, although default likely could be staved off until mid-October, thanks to “extraordinary measures” the Treasury put in place in March to delay a debt reckoning.   Legislation to raise the debt limit will need to be adopted, at the very latest, by early to mid-October. If the debt ceiling is not raised, the government would not be able to borrow more money or pay its bills, including payments on its debts, which could hurt the U.S. credit rating. Political gridlock has never led to the United States reaching its debt ceiling and its bills going unpaid, but there have been close calls. An August 2011 standoff cost the country its top-notch bond rating from the credit rating agency Standard & Poor’s and caused the most jarring two weeks in financial markets since the 2007-2009 global financial crisis. The two move on separate tracks, but are likely to get tangled together, with Republican opponents of a debt ceiling increase likely demanding federal spending cuts. Some analysts say Congress may try to tackle both issues at the same time. Both the spending and debt ceiling bills can pass the Republican-led House of Representatives by a simple majority vote, but will need 60 votes to pass the Senate, where Republicans hold 52 of 100 seats, meaning they will need some Democratic support.  Trump made his U.S.-Mexico border wall a central promise of his 2016 presidential campaign. He also promised that Mexico would pay for the wall, but Mexico has steadfastly refused and Trump has largely stopped talking about that pledge. Conservative House Republicans agree with the Republican president on the need for a wall and say border-wall funding should be a priority in any spending legislation. Some of them have already indicated they are willing to shut down the government to get it. Moderate Republicans have called a shutdown unwise and Republican leaders are determined to prevent one, fearing it would worsen doubts about the party’s ability to govern. Democrats are uniformly opposed to Trump’s wall and say the responsibility for a shutdown would rest solely with Republicans. The Trump administration reversed course earlier this month and said it would back a “clean” raising of the debt ceiling, meaning it would not be tied to other policy measures. Democrats and moderate Republicans also support a clean debt-ceiling increase. But conservative Republicans, especially in the House, often use debt-ceiling legislation to insist on changes to spending, making them opposed to a clean bill. 
Factbox: Trump's government shutdown threat, looming debt ceiling