The longest shutdown in American history ended on Friday, after 34 full days. That easily exceeded the previous record, under President Bill Clinton in 1995, of 21 days.

In total, there have been 21 gaps in government funding since 1976, though the level of shutdown has varied. The current federal shutdown is a partial one, as many agencies were already funded through this fiscal year, which ends in September.

START DATE PRESIDENT LENGTH IN DAYS DEC. 22, 2018 Trump 34 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X DEC. 16, 1995 Clinton 21 X X X X X X X X X X X X X X X X X X X X X OCT. 1, 1978 Carter 17 X X X X X X X X X X X X X X X X X OCT. 1, 2013 Obama 16 X X X X X X X X X X X X X X X X OCT. 1, 1977 Carter 12 X X X X X X X X X X X X OCT. 1, 1979 Carter 11 X X X X X X X X X X X OCT. 1, 1976 Ford 10 X X X X X X X X X X NOV. 1, 1977 Carter 8 X X X X X X X X DEC. 1, 1977 Carter 8 X X X X X X X X NOV. 14, 1995 Clinton 5 X X X X X DEC. 18, 1982 Reagan 3 X X X NOV. 11, 1983 Reagan 3 X X X OCT. 6, 1990 Bush 3 X X X NOV. 21, 1981 Reagan 2 X X OCT. 1, 1984 Reagan 2 X X JAN. 20, 2018 Trump 2 X X OCT. 1, 1982 Reagan 1 X OCT. 4, 1984 Reagan 1 X OCT. 17, 1986 Reagan 1 X DEC. 19, 1987 Reagan 1 X FEB. 9, 2018 Trump 1 X Note: Start dates are the beginning of each shutdown, which is one day after budget authority expired. The length of completed shutdowns is the number of full days before the day that funding was approved.

The roots of today’s dysfunction date back to some critical decisions starting in the 1970s. Here’s a look at why the American government has lurched into crisis over the budget so often since then.

(Last month, The New York Times examined the history of federal government shutdowns. Below is a version of that breakdown, which has been lightly edited.)

Before the 1970s, the federal government would in some cases spend money without prior congressional approval, said Jim Broussard, the director of the Center for Political History at Lebanon Valley College in Annville, Pa.

A 1974 law reorganized the budgeting process, shifting power from the executive branch to Congress. Tense disagreements quickly emerged.

President Jimmy Carter at the White House in October 1978. Bob Daugherty/Associated Press

In 1977, the House of Representatives and the Senate fought over whether Medicaid should be used to pay for abortions. That led to three separate instances in which the government could not provide funding for the Departments of Labor and Health, Education and Welfare. The shutdowns added up to a total of 28 days that year.

Another gap in funding the following year, when President Jimmy Carter took issue with a costly public works bill and defense spending, lasted 17 days.

Benjamin R. Civiletti taking the oath of office as United States attorney general in 1979. Associated Press

Two legal opinions issued by the United States attorney general, Benjamin R. Civiletti, in 1980 and 1981, made shutdowns much more severe.

Until that point, most agencies could continue to operate even if funding bills hadn’t been passed, with the understanding that money would eventually be approved.

[Sign up for the Morning Briefing newsletter for a look at what you need to know to begin your day.]

But Mr. Civiletti argued that it was illegal for the government to spend money without congressional appropriations. The few exceptions included work by federal employees to protect life and property, he wrote.

That, in turn, prompted an increased frequency of small shutdowns as politicians struggled with deadlines, said Roy T. Meyers, a political science professor at the University of Maryland, Baltimore County, who has written about the history of shutdowns.

President Ronald Reagan in November 1981. United Press International

In November 1981, President Ronald Reagan, in a fight with Congress over $8.5 billion in budget cuts he wanted, ordered the furlough of 241,000 government employees. It was the first time a shutdown of that size was ordered.

A congressional subcommittee estimated that the two-day shutdown cost taxpayers between $80 million and $90 million, including administrative costs, such as figuring out who could and couldn’t work and paying workers who didn’t work.

Shutdowns that included furloughs in 1984, 1986 and 1990 cost taxpayers at least $128 million, according to government estimates.

A 21-day government shutdown in 1995 and 1996 during President Bill Clinton’s administration had been the longest. David Scull/The New York Times

The longest previous shutdown came in 1995. At issue was a long-term budget backed by Republicans, who won control of both the House and the Senate halfway through Mr. Clinton’s first term.

Their plan limited spending for Medicare and turned Medicaid and most other welfare programs over to the states. House Republicans, in particular, were keen on using a shutdown to get Mr. Clinton to sign their bill.

A five-day shutdown in November was followed by the record-breaker — 21 days — starting in mid-December. That conflagration helped pave the way for the 2013 shutdown over President Barack Obama’s health care law.

Left: Speaker of the House John A. Boehner before voting on Oct. 16, 2013. Right: President Barack Obama at the White House on Oct. 11, 2013. Doug Mills/The New York Times

The 2013 shutdown lasted for 16 days and ended amid dire warnings from the Treasury Department that it was about to run out of money. Having failed in their bid to defund Obamacare, Republicans leaders eventually worked with their Democratic counterparts on a plan to reopen the government and raise the debt ceiling.