Denied, at least for now, congressional approval for his promised border wall, President Trump has asserted he has “the absolute right” to declare a national emergency, threatening to build the wall by executive fiat. And while the courts will need to sort out whether he can use these powers to work around Congress’s power of the purse, Trump is right that he has immense authority to do just this sort of thing — and Congress is to blame.

The presidency did not acquire vast emergency powers overnight. Well-meaning post-Vietnam reforms and decades of congressional myopia have made declaring a legally dubious national emergency a plausible gambit. If Congress wants to find the source of Trump’s emergency powers, and by extension, a way to curb them, lawmakers should start by looking in the mirror.

The first modern national emergency began 86 years ago. In his first inaugural address, Franklin D. Roosevelt, confronting the daunting task of a banking crisis and the Great Depression, sought to take immediate action by asking Congress “for the one remaining instrument to meet the crisis — broad executive power to wage a war against the emergency, as great as the power that would be given to me if we were in fact invaded by a foreign foe.”

The next day, Roosevelt used a defunct emergency law from World War I to declare a national bank holiday and waited for Congress to validate his truly unprecedented measure four days later. In an emergency session, the House voted to give the president sweeping economic powers in only 38 minutes. A more pensive Senate took the next eight hours to approve the Emergency Banking Act, which the New York Times reported as “Roosevelt Gets Power of Dictator.” Herbert Hoover likened Roosevelt’s bank holiday to the Reichstag fire that enabled Adolf Hitler to assume dictatorial power in Germany.

Roosevelt’s emergency declaration launched a decades-long trend of Congress passing laws authorizing the president to take extraordinary steps after declaring a national emergency. Combined, these statutes gradually accumulated into an immense legal framework. While some individual emergency laws were insignificant, allowing the president to, for example, requisition watercraft, others were far more imposing, such as those that authorized the president “[to] organize and control the means of production,” “assign military forces abroad,” “seize and control all transportation and communication,” and “in a plethora of particular ways, control the lives of all American citizens,” according to a Senate committee report.

Not until Vietnam, when Lyndon B. Johnson took the Tonkin Gulf Resolution far beyond its original intent and Richard Nixon bombed Cambodia without congressional input, did Congress reckon with the scope of what it had created. As Congress debated the War Powers Resolution and investigated the Watergate scandal, Sens. Frank Church (D-Idaho) and Charles Mathias (R-Md.), both leaders of congressional opposition to Vietnam, led a bipartisan committee to assess and reform the president’s emergency powers.

Church and Mathias discovered 470 emergency statutes, which, they concluded in their committee’s report, “taken together, confer enough authority to rule the country without reference to normal Constitutional processes.” Church remarked that these powers “were like a loaded gun lying around the house, ready to be fired by any trigger-happy president who might come along.” These laws, he argued, were a “blueprint for a dictatorship,” and Congress itself had sketched it.

Theoretically, the president was limited because he could wield these powers only during a declared national emergency. Shockingly, however, the senators found four existing national emergencies that a president could draw on at any given time: Roosevelt’s 1933 national emergency during the Great Depression, Harry Truman’s 1950 proclamation during the Korean War and two declared by Nixon. This meant that in 1973, a majority of Americans had spent their entire lives existing in a state of emergency, although practically no one knew it.

In July 1974, as Watergate consumed the Nixon administration, Church and Mathias drafted the National Emergencies Act to reclaim Congress’s emergency authority and rein in what historian Arthur Schlesinger had dubbed an “imperial presidency.” Their initial bill aimed to repeal the 50 most potent emergency statutes, end the four existing emergencies and create a procedure for declaring future emergencies, which would automatically terminate after 180 days. The law also would have required emergency declarations to specify which statutes they would call upon and allowed Congress to terminate an emergency by concurrent resolution, which was exempt from the president’s veto.

But the Ford administration, which took over after Nixon’s resignation, balked. After first tepidly endorsing the bill, Gerald Ford backed off, pushed by conservative staffers such as Dick Cheney who wanted to preserve the power of the presidency against perceived congressional encroachment. The administration threatened a veto unless Congress added certain amendments, which Mathias attached. This enabled a watered-down bill to pass the Senate, its effectiveness seriously damaged.

The new version established a nine-month grace period for Congress to rework objectionable emergency statutes and ditched the automatic termination of national emergencies. Instead, Congress was required to meet every six months to vote on ending a national emergency; the emergency would then terminate after a year, but the president could extend it indefinitely simply by notifying Congress. This minor procedural adjustment had profound consequences because it required congressional initiative to change the status quo.

Not once since the National Emergencies Act passed both houses overwhelmingly in 1976 has Congress held the required vote on a national emergency. As a result, every president since Jimmy Carter has declared national emergencies, adding up to 58 new declarations, of which 31 are still in effect. Many so-called emergencies block specific individuals engaged in, for example, cyberattacks or human rights violations in Venezuela from accessing property in the United States, making emergency powers a key component of U.S. foreign policy.

The danger of the National Emergencies Act is that it gives the president nearly absolute discretion in declaring an emergency, which is why the Sudanese Civil War, Somali pirates and, now, potentially a crisis at the southern border rise to the level of national emergencies.

The Supreme Court is also partially responsible for neutering the National Emergencies Act. In a 1983 case, the court ruled that a congressional resolution could not override an emergency declaration without the president’s signature. The need to overcome an inevitable veto forces Congress to muster a two-thirds vote in both houses should it ever try to claw its power back under the terms of the National Emergencies Act.

Like the War Powers Resolution, Congress intended this legislation to check the president, but it has had the opposite effect. Most Americans are probably unaware that the United States has lived under a national emergency since the 1979 Iran hostage crisis. Nor has Congress ceased delegating the president substantial emergency powers; a recent Brennan Center for Justice study found 136 emergency statutes, some of which could redirect Defense Department funds and expedite military construction for the wall.

Emergency powers are a creation of Congress, which has yielded to the executive’s unity and decisiveness during crises. Thanks to these concessions, a president with little respect for separations of power, American institutions and our system of government has all the tools he needs to assume breathtaking power, upsetting the constitutional order in the most dangerous ways. The current Congress should take note of this history and look for ways to more effectively restore power to the legislative branch.