Less than two days after President Trump signed an executive order restricting travel from seven Muslim-majority countries, lawyers in four states have, as promised, taken him to court and won. The first ruling came on Saturday night from the Eastern District of New York, headquartered in Brooklyn, where Judge Ann M. Donnelly issued an emergency injunction on Trump’s ban. Her judgment, which explicitly mentioned refugees and visa holders but not green-card holders, extends nationally and will remain in effect until a follow-up hearing on February 21st. Soon after Donnelly’s ruling, a federal judge in Virginia barred the government from deporting permanent residents detained at Dulles International Airport. Then, in Seattle, another judge temporarily blocked two specific deportations. After the hearing in Brooklyn, outside the courthouse, hundreds of demonstrators, some of whom had come directly from protests at John F. Kennedy International Airport, shouted, “Let them stay!”

In Boston, the scene was more restrained. At 11:30 P.M., the streets outside the John Joseph Moakley Courthouse were largely empty. Inside, around ten lawyers sat in a sweltering hearing room with a clerk, a handful of reporters, and two judges, U.S. District Judge Allison D. Burroughs and Magistrate Judge Judith Gail Dein. One lawyer wore a suit, but others had come from social functions, including a birthday party. The room was tense but quiet; it felt far from the demonstrations at Logan International Airport, just a few miles away, where protesters—including Senator Elizabeth Warren and Marty Walsh, the mayor of Boston—crowded one terminal. “Half of us came directly from the airport,” Laura Rótolo, a staff attorney at the A.C.L.U. of Massachusetts, said of the civil-rights lawyers in attendance. The hearing was clearly unexpected; one court security guard told me that he had been called in from his high-school reunion.

The original legal complaint in Boston pertained to an Iranian-born couple, Mazdak Pourabdollah Tootkaboni and Arghavan Louhghalam, professors at the University of Massachusetts Dartmouth, who had travelled to France for an academic conference and been detained when their plane landed at Logan, on Saturday. Though both were eventually released, their lawyers met the legal requirements to certify a class, meaning that any decision about their case would apply to other travellers in similar situations. One of the attorneys’ aims was to require Customs and Border Protection to notify airlines of the ban’s stay. Another was to expand the Brooklyn ruling to explicitly include green-card holders—that is, to compel the government to accept the travel documents that it issued before Trump signed his order.

As the hearing began, the judges and lawyers were still trying to understand the details of court orders elsewhere in the country. “Did anybody get ahold of the Virginia order?” asked one judge. An immigration lawyer, Susan Church, of the firm Demissie & Church, responded that she had managed to download a PDF of it from the New York Times. Their confusion was not only due to the hectic timing; as CNN reported, it was also the result of an extraordinary lack of clarity in the writing of the executive order itself. Not long after midnight, a court recess was called, to give the legal team time to write a draft order. At 1:13 A.M., the lawyers were still standing around, trading cell-phone chargers and updates from colleagues elsewhere in the country. Church was waiting for her husband and law partner, Derege Demissie, to send a draft of the new order from home. The lawyers, though tired and at times almost frantic, seemed optimistic. “The law is on our side,” Rótolo said.

Finally, a few minutes after one-thirty, the clerk walked into the hearing room with a stack of papers. She asked the attorneys to sign, and not to tweet, the document, which had been drafted by the lawyers and revised by the judges. “We got everything we wanted,” Church said, before finding a pen and signing her name. “We got the airlines,” she added, meaning that the government would indeed need to notify airlines of the ruling. Ray Farquhar, a lawyer from the U.S. Attorney’s office who represented the federal government, said little, and stated no objections to the court order. He left in a hurry.

The final court order, though released too late to make immediate headlines, represents an important expansion of the stay issued in Brooklyn. Unlike the original stay, it lasts only one week, during which attorneys will have to file an updated complaint and attend a second hearing. But Matt Segal, the legal director of the A.C.L.U. of Massachusetts, said that the framing of the court order suggests that it applies across the country; if so, for seven days, the federal government will not be allowed to use Trump’s executive order to detain or deport travellers with valid visas, green cards, or refugee status. Lawyers also said that travellers who have not yet departed for the United States should be able to do so.

The legal fight will, of course, continue. According to Segal, this particular battle—likely the first of many—may provide a useful road map. “This executive order is really the first one that started to affect people immediately,” he said. He described himself as “a switchboard,” connecting different wings of an informal legal partnership that, only a day earlier, had not existed. “I can’t tell you there was a recipe for what happened, but we’ve been setting ourselves up to respond in this way,” he said. “It was an opportunity for civil-rights lawyers, for regular people, for immigrants in this country, and for courts, to talk back.”