When President Donald Trump used his first week in office to target immigrants and refugees with three separate executive orders, legal and advocacy groups, law-school clinics, and private attorneys across the country leaped into action.

Within 48 hours of the refugee ban’s going into effect, teams of lawyers and students from a Yale Law School clinic, along with ACLU and other legal groups, filed a writ of habeas corpus for an Iraqi man to request a “stay of removal,” and sought to establish a national class of similarly situated individuals. The same day they filed, a judge in Brooklyn issued a restraining order that temporarily prohibited the government from removing individuals affected by the order.

It was lightning-fast lawyering from an ad hoc collection of volunteer attorneys and law-school students, and it set the frenetic pace of legal action that has continued throughout Trump’s first month in office. One law-news site counted 39 lawsuits against Trump related to his immigration ban in just his first two weeks in office. The total number of lawsuits filed against Trump during that time was more than 70.

How did all of this legal activity happen seemingly spontaneously in reaction to what seemed to many of us like a surprise executive order? After all, many government agencies that would have been vital to the enforcement of the order learned of its implementation from news reports, the same as the rest of us.

In the Washington, DC, area, the refugee ban sparked a new kind of legal resistance group into being: Within 24 hours of a call to action from the International Refugee Assistance Project (IRAP), lawyers and volunteers descended on Virginia’s Dulles airport, forming, from scratch, the Dulles Justice Coalition. The coalition set up a pop-up legal clinic, complete with computers, printers, and donated pastries as fuel. One handwritten poster hanging off a folding table read: “If You Saw Anyone Detained, Talk to Us. Free Lawyers.”

DC-area supporters were not alone—at international airports across the country, protests, vigils, and legal blitzes fought back against “Trump’s Muslim ban.” While the executive order is currently suspended nationwide thanks to a ruling in Washington State upholding an earlier challenge to the order, the organizations that, however temporarily, derailed the order are now planning new ways to combat the administration’s next infringement on civil liberties.

Litigating through a Tragic First Act

On February 7, HIAS, a refugee resettlement agency based in Maryland, which was founded in the 1880s to resettle Jews fleeing Russian pogroms, along with IRAP and four plaintiffs from Iran and Iraq, filed the first lawsuit challenging the executive order in its entirety, claiming that it was “intended and designed to target and discriminate against Muslims, and it does just that in operation.” The lawsuit is the spearhead of increasingly coordinated efforts to resist the administration inside the court room.

“This is the first act in a long tragedy,” Benjamin Johnson, executive director of American Immigration Lawyers Association (AILA), told me. AILA is a national association of about 14,500 immigration lawyers that advocates and educates for “reasonable immigration law and policy,” by training and supporting its members. Johnson mentioned that the first two of Trump’s orders (about border security and interior immigration enforcement), though not inspiring the same degree of protest, or having the same immediate effects that the refugee ban caused, could be “much more far-reaching and devastating in the long-term.” AILA’s members, he explained, are thus “prepared to be zealous, aggressive lawyers.” Their efforts won’t be without precedent, but they will be redoubled: “We’re going to do what lawyers do best—lawyer up.” AILA has teams continuing to analyze the orders and actions, pursue further litigation, file complaints with the office of civil rights and civil liberties, as well as engage members of congress, who have been coming to AILA looking for help in interpreting the orders, which many have described as confusing, poorly written, and even malicious.

Gadeir Abbas, a lawyer for the Council on American-Islamic Relations (CAIR), saw the executive order as the “first salvo in a campaign of anti-Muslim activity.” CAIR responded by filing Sarsour v. Trump, in which they referred to the executive order as the “Muslim Exclusion Order.” Taking the government to court is one tactic in pushing back against what Abbas also called “an avalanche of anti-Muslim activity.” Abbas explained that it’s not just Muslim refugees or Muslim immigrants who are impacted by the ban but all Muslims in America. “The religion is stigmatized,” he said. The order is an attack on Muslim civil society, Abbas said, which, along with a long campaign filled with anti-Muslim barbs, sends “a message that Islam is inherently dangerous,” and parallels a sharp rise in anti-Muslim hate crimes.

Expanding the Legal Tool Chest

Yale Law School legal clinics, as well as the American Immigration Council (AIC), have created templates for attorneys to use, so they don’t have to work ex nihilo if (likely when) the ban is reinstated, or if Customs and Border Protection (CBP) officials don’t comply with the stay. They have also set up e-mail alert systems for people to report if CBP is detaining or returning people in airports. In the days after the order was issued, even after the restraining order had been issued in Brooklyn, there were reports of CBP agents coercing people into signing forms that would have them voluntarily giving up their green cards.

Offensive Efforts

Catholic Legal Immigration Network, or CLINIC, and other groups, are also trying to do protective, proactive work. According to a Center for Migrations study, up to 20 percent, or 2.2 million, of the 11 million unauthorized immigrants currently in the country might qualify for some type of relief, including Deferred Action for Childhood Arrivals (DACA). That is many more people than have applied for or benefited from relief, which is about 750,000. Atkinson explained how legal groups are doing what they do best—analysis. Both CLINIC and AILA are working to educate their attorneys, as well as their clients and communities, to understand the status of the law, and what options remain available. CLINIC has also initiated, in direct response to “the urgent circumstances” of “anti-immigrant sentiment aimed at the most vulnerable” the Defending Vulnerable Populations Project, which will run immigration-law trainings and work to increase access to legal counsel. Gaining some form of legal status now, before further deportation raids or other anti-immigrant orders could offer a shield for millions. After the stay on the ban was issued in Washington, Becca Heller, of IRAP, told her clients “to get on the plane, right now.”

Perhaps the largest of the legal organizations working to file legal actions against Trump, the ACLU promises to “mount rapid response to immigration raids” at the same time that it continues to file “systemic litigation” to challenge the administration’s immigration policies. Since the election, the ACLU has also received nearly $80 million dollars in donations, flooding the coffers of a movement often woefully outmatched in funding.

International and Private Support

Efforts are not restricted to the United States. Hundreds of lawyers also volunteered abroad, in airports in Amsterdam, Frankfurt, London, Cairo, and Dubai, among others. Sara Dill, a criminal-defense and international-law attorney in DC who was an early volunteer with the Dulles Justice Coalition, told me how she helped coordinate international efforts, pairing up foreign attorneys with immigration attorneys in the United States. In Amsterdam, both Dutch lawyers and American lawyers abroad prepared for clients who might have been barred from boarding US-bound flights by taking steps to help them gain temporary EU status. In sum, according to Dill, there were about 1,500 international lawyers who volunteered to help. (In the United States, multiple attorneys put the number of volunteers higher than 20,000.) “Lawyers are standing by, ready, and waiting to assist if international efforts are needed,” Dill told me.

Jennifer Geeter, of McDermot Will & Emery, a private firm, who responded to IRAP’s call and showed up at Dulles that first weekend, described the collaborative efforts between private firms, legal clinics, and organizations. “It’s been an all hands on deck moment,” Geeter said.

Protection Outside of the Courts

Outside of courtrooms, legal and advocacy groups are engaging in further public outreach and grassroots organizing, digging in for future policy changes, other executive orders, and ICE raids.

Salvador Sarmiento, of National Day Laborers Organizing Network (NDLON), explained the importance of grassroots organizing, on top of litigation or congressional lobbying, in the fight to resist anti-immigrant policies. He offered the example of then-Sheriff Joe Arpaio’s being defeated by day laborers, and talked about a surge of highly attended “Migra Watch” trainings and Know Your Rights workshops that NDLON has been offering in Los Angeles and other cities. They’ve also initiated an Alto Trump, or Stop Trump campaign, which is based off of their Alto, Arizona, efforts resisting Arizona’s notorious anti-immigrant law, SB 1070.

Similarly, responding to what Abbas described as the “profound sense of urgency in the Muslim community,” CAIR and other Muslim organizations are holding increased Know Your Rights workshops, and are reaching out to new partners, such as Black Lives Matter organizers. They are also looking towards DC, holding events such as National Muslim Advocacy Day on Capitol Hill, in which Muslims and lawmakers can interact. Abbas told me that there is “a growing recognition that part of the challenge to the Muslim community in the US is legal in nature. Just as the NAACP had a phalanx of lawyers advancing their work in the civil-rights movement, the Muslim community needs its own lawyers.” CAIR recently sent letters to legislators and state officials in five states (Idaho, Arkansas, Montana, Kentucky, and Oregon) challenging the constitutionality of proposed anti-Muslim legislation. CAIR is also actively supporting legislation introduced by Senator Cory Booker, to block the creation of a Muslim registry, and by Senator Kamala Harris, which would guarantee legal counsel to those detained upon entry to the United States. Robert S. McCaw, the director of government affairs of CAIR, described their strategy as “counterpunch, counterpunch, jab.”

Public Defender and activist Margo Cowan, of No More Deaths and Keep Tucson Together, has signed and distributed approximately 1,200 G-28s (an immigration form granting power of attorney) to people concerned that they may be stopped by police and fall into the hands of ICE. In a packet to go along with the signed G-28 is a letter (also signed by Cowan) telling officers, “Please do not ask my client questions” and “I have instructed my client to document your name, badge number,” and other pertinent information. The paperwork, along with as many as 25,000 bright-yellow yard signs informing all law-enforcement officials, “Do Not Enter Without a Lawful Search Warrant” (with “Resist” diagonally watermarked in large letters), is meant to create “a buffer zone” of protection. “We must be proactive rather than reactive,” Cowan said. Though the government’s policies are “designed to scare,” Cowan says, the laws on the still offer forms of protection.

Partnerships Forged by Crisis

The structure that Dulles Justice Coalition, and many other ad hoc groups around the country, have set up in the past weeks, lawyer Sirine Shebaya told me, “will be very useful for the next constitutional crisis,” which many suspect will be coming soon.

Benjamin Wittes, writing for the blog Lawfare, explained how “the President has created a target-rich environment for litigation.” Besides the amicus briefs filed by major tech corporations—like Apple and Google—numerous universities, legal and advocacy groups, and legal clinics are also signing onto litigation.

I asked Melissa Crow, of AIC, if she is sitting down and doing long-term strategizing, apart from reacting to the orders, and her answer was understandable: “I haven’t even had the chance to sit down.” But she also emphasized the need to collaborate with “unconventional partners,” apart from those typically involved in immigration matters. She mentioned the National Prison Project, Same Sex Marriage lawyers, the Criminal Defense Bar, and the Constitutional Accountability Center as new and valuable partners for those advocating for immigrants.

“We all know more immigration raids are on the horizon,” Crow said, and AIC lawyers are preparing themselves, “training up,” sharing strategies, reallocating resources, preparing more practice advisories, and studying history—looking for tactics from when other raids have happened in the past. “The removal net,” Crow said, “is going to be broader than ever before. A lot of non-immigration lawyers have contacted us” looking to assist in protecting residents. “I’ve never seen so much good will pouring out from places we never expected,” Crow said.

With anti-immigrant hawk Jeff Sessions now confirmed as attorney general, and with the Trump administration promising to double down on “extreme vetting,” the militarization of the border, and the fulfillment of its anti-immigrant and anti-Muslim agenda, expect to see more resistance both in the streets and in the courtroom. Sarah Dill, of the Dulles Justice Coalition, said lawyers “are preparing for every possible scenario.… We are going to be ready to defend.”