Lawmakers were hoping to prevent another government shutdown in 2018 — but failed to reach a deal by midnight on Dec. 22. As a result, the federal government witnessed its longest shutdown in history.

The government has now shut down a total of 21 times since Congress introduced the Congressional Budget and Impoundment Control Act, which established the federal budget process in 1976. Half of those shutdowns occurred over a weekend.

"I call them 'fake shutdowns,'" Marc Goldwein, senior policy director of the Committee for a Responsible Federal Budget – a bipartisan, nonprofit organization that educates the public on fiscal policy issues – told Fox News. “Most shutdowns occur over the course of a weekend. We’re talking days or weeks – not months.”

WHAT HAPPENS DURING A GOVERNMENT SHUTDOWN? 7 THINGS YOU SHOULD KNOW

But there have been a handful of lengthy U.S. government shutdowns. According to data from the Congressional Research Service (CRS), seven shutdowns in the past four decades lasted more than 10 days.

On Jan. 12, the government reached its 22-day mark, breaking the record for the longest shutdown in U.S. history. The previous record-holder occurred during the Clinton administration in the winter of 1995 to 1996 when former President Bill Clinton and the Republican Congress were at odds and shut the government down for a total of 21 days. The third occurred during the Obama administration in 2013. A stalemate between the House and Senate led to a 16-day hiatus.

Here is a look back at every government shutdown in the history of the U.S.

President Gerald Ford

When: Thursday, Sept. 30 to Monday, Oct. 10, 1976

Duration (full days): 10 days

The first partial shutdown occurred under Gerald Ford’s presidency when Ford vetoed a $56 billion spending bill for the Departments of Labor and Health, Education and Welfare, according to a 1976 report from The New York Times.

This was the year the Congressional Budget and Impoundment Control Act became law, allowing Congress to take an extension, known as a continuing resolution (CR).

President Jimmy Carter

When: Friday, Sept. 30 to Thursday, Oct. 13, 1977

Duration (full days): 12 days

When: Monday, Oct. 31 to Wednesday, Nov. 9, 1977

Duration (full days): 8 days

When: Wednesday, Nov. 30 to Friday, Dec. 9, 1977

Duration (full days): 8 days

There were three shutdowns, referred to as the "abortion shutdowns," in the late 1970s under the presidency of Jimmy Carter. The Democratic party may have dominated both the House and the Senate, but they couldn't get Republicans on board when it came to using Medicaid to pay for abortions.

When: Saturday, Sept. 30 to Wednesday, Oct. 18, 1978

Duration (full days): 17 days

In 1978, Carter vetoed a $37 billion defense authorization bill, which included a $2 billion nuclear-powered Nimitz-class aircraft carrier -- equipment he didn't consider essential to national security, The Washington Post reported. This led to the second largest shutdown in the history of the nation.

When: Sunday, Sept. 30 to Friday, Oct. 12, 1979

Duration (full days): 11 days

Another funding gap took place a year later when the House and Senate disagreed over raising pay by 5.5 percent for members of Congress and senior civil servants, The Washington Post reported. And there was yet again another debate over abortion funding.

President Ronald Reagan

When: Friday, Nov. 20 to Monday, Nov. 23, 1981

Duration (full days): 2 days

President Ronald Reagan vetoed a spending bill because it didn't make enough cuts.

When: Thursday, Sept. 30 to Saturday, Oct. 2, 1982

Duration (full days): 1 day

The government shut down for one day when Congress failed to pass the spending bill on time.

When: Friday, Dec. 17 to Tuesday, Dec., 21, 1982

Duration (full days): 3 days

Both the House and Senate wanted to increase public works spending in order to create more jobs -- a move Reagan opposed. The House also opposed MX missile funding, which, The Washington Post noted, was a "major defense priority" of Reagan's.

When: Thursday, Nov. 10 to Monday, Nov. 14, 1983

Duration (full days): 3 days

Reagan argued over the Democratic-controlled House's proposed foreign aid and spending cuts and their plea for an increase in funding for education. At the same time, Reagan was pushing for more funding for the MX missile.

Eventually, both parties reached an agreement.

When: Sunday, Sept. 30 to Wednesday, Oct. 3, 1984

Duration (full days): 2 days

In short, Reagan agreed to the House's proposed crime-fighting package, but he opposed their water projects package.

"Reagan offered to forgo his crime bill in exchange for junking the water package...but a deal wasn't reached in time to avoid a brief shutdown," The Washington Post reported.

When: Wednesday, Oct. 3 to Friday, Oct. 5, 1984

Duration (full days): 1 day

Lawmakers reportedly needed another day to discuss the spending bill.

When: Thursday, Oct. 16 to Saturday, Oct. 18, 1986

Duration (full days): 1 day

The Democratic-controlled House was once again in disagreement with Reagan and the Republican-controlled Senate. This time, over a welfare package deal.

When: Friday, Dec. 18 to Sunday, Dec. 20, 1987

Duration (full days): 1 day

Reagan and Democrats couldn't agree on funding for Nicaraguan "Contra" militants. Democrats also pushed to reinstate the "Fairness Doctrine," which required licensed broadcasters to give equal air time for people with competing political points of view.

President George H.W. Bush

When: Friday, Oct. 5 to Tuesday, Oct. 9, 1990

Duration (full days): 3 days

Only one shutdown took place during George H.W. Bush’s presidency. It occurred in October 1990 after Bush vetoed a stopgap spending bill, The New York Times reported at the time.

But the timing was right. The shutdown happened over Columbus Day weekend and most federal workers were already off for the holiday.

President Bill Clinton

When: Monday, Nov. 13 to Sunday, Nov. 19, 1995

Duration (full days): 5 days

President Bill Clinton vetoed a continuing resolution in November 1995 over Medicare premium increases.

"The government is partially shutting down because Congress has failed to pass the straightforward legislation necessary to keep the government running without imposing sharp hikes in Medicare premiums and deep cuts in education and the environment," Clinton said during an address on Nov. 14, 1995.

When: Friday, Dec. 15, 1995, to Saturday, Jan. 6, 1996

Duration (full days): 21 days

It's the second longest shutdown in U.S. history: 21 days.

The government shut down after Clinton vetoed the spending bill proposed by the Republican-controlled Congress.

After a long three weeks, the president and Congress agreed to a seven-year budget plan, which included "modest spending cuts and tax increases," according to research by the Regional Oral History Office at the University of California, Berkeley.

President Barack Obama

When: Monday, Sept. 30 to Thursday, Oct. 17, 2013

Duration (full days): 16 days

Seventeen years later, the government shut down once again. Lawmakers couldn't come to an agreement on the Affordable Care Act, also known as Obamacare, in 2013.

The House passed several versions of the bill to fund the government. But each time, the Senate sent it back.

“This is an unnecessary blow to America,” Harry Reid, the Senate Democratic leader at the time, said of the shutdown.

John Boehner, the House speaker during the shutdown, said Republicans were fighting to keep the government open, but the Senate "continued to reject our offers.”

President Donald Trump

When: Saturday, Jan. 20 to Monday, Jan. 22, 2018

Duration (full days): 3 days

When it comes to immigration and spending, President Donald Trump and Republican lawmakers and Democrats were divided.

Republicans controlled the Senate but they still needed 60 votes to break a filibuster.

"When you only have 51 votes in the Senate, then you have to have Democrat support in order to keep the government — to fund the government," OMB Director Mick Mulvaney told reporters during a White House press briefing Friday.

Democrats said from the beginning that they'd reject any deal that didn't include a legislative fix for the Deferred Action for Childhood Arrivals (DACA) program, an Obama-era program, which offers protection for immigrants — also known as "Dreamers" — who came into the U.S. illegally as minors.

“I'm proud of the House and Senate Democrats' unity in insisting on a budget that supports our military and the domestic investments that keep our nation strong and honors the values by protecting our DREAMers," House Minority Leader Nancy Pelosi, D-Calif., said in a statement as the government shut down.

Trump, on the other hand, said Democrats only had themselves to blame when it came to both shutting down the government and failing to make a deal on DACA.

PARTIAL GOVERNMENT SHUTDOWN TIMELINE: FROM TRUMP'S DEMANDS TO DEMOCRATS' PROPOSALS

"Deals can’t get made when there is no trust! Durbin blew DACA and is hurting our Military," Trump tweeted. "DACA is probably dead because the Democrats don’t really want it, they just want to talk and take desperately needed money away from our Military."

In the end, Democrats reached a compromise to reopen the government through Feb. 8 — with one condition.

“After several discussions, offers, counter-offers, the Republican leader and I have come to an arrangement," Senate Minority Leader Chuck Schumer, D-NY, said on the Senate floor. "We will vote today to reopen the government to continue negotiating a global agreement, with the commitment that, if an agreement isn’t reached by February 8, the Senate will immediately proceed to consideration of legislation dealing with DACA.”

When: Friday, Feb. 9, 2018

Duration: 9 hours

Republican and Democratic senators announced a two-year budget agreement on Feb. 7 that included an increase in military spending, an extension for the Children’s Health Insurance Program and additional funds for disaster relief, among other issues.

"I am pleased to announce that our bipartisan, bicameral negotiations on defense spending and other priorities have yielded a significant agreement," Senate Majority Leader Mitch McConnell, R-Ky., said in a speech on the House floor.

It's a deal "neither side loves, but both sides can be proud of," Senate Minority Leader Schumer, D-N.Y., added.

But not everyone was a fan of the deal.

House Minority Leader Nancy Pelosi, D-Calif., slammed the plan for not addressing immigration.

"[The] package does nothing to advance bipartisan legislation to protect Dreamers in the House," said Pelosi, as she shared the stories of "Dreamers" on the House floor for more than eight hours. "Without a commitment from Speaker Ryan comparable to the commitment from Leader McConnell, this package does not have my support."

Sen. Rand Paul, R-Ky., also voiced his frustration with the deal, which he said irresponsibly busted through budget caps and increased the country's deficit even more.

"I ran for office because I was very critical of President Obama's trillion-dollar deficits," Paul said. "Now we have Republicans hand in hand with Democrats offering us trillion-dollar deficits. I can't in all honesty look the other way."

A last-minute maneuver by Paul led to an hours-long shutdown.

In the end, Congress agreed to pass the $400 billion deal and it was on Trump's desks within hours. He announced that he had signed the bill at 8:40 a.m. ET.

When: Saturday, Dec. 22, 2018

Duration: Friday, Jan. 25, 2019

Democrats and President Trump were at an impasse over a spending bill – particularly in regards to funding for border security. As a result, and just ahead of Christmas, the government partially shuttered at midnight on Dec. 22.

Trump had urged Senate Republicans to use the so-called “nuclear option” to pass a spending bill that included enough funding for a border wall. The House scrambled to put together a package that included the $5.7 billion the president wanted but was unable to agree on a deal to fund the government by the deadline.

Trump has warned a closure could drag on “for a very long time.” When it surpassed the 22-day mark on Jan. 12, it became the longest government shutdown in U.S. history.

Fox News' Kaitlyn Schallhorn contributed to this report.