The three Democratic lawyers met over dinner in a cavernous hotel in Fort Lauderdale, Fla., picking at seafood as they discussed how to take on President Trump: Eric T. Schneiderman, the attorney general of New York; Josh Shapiro, his counterpart in Pennsylvania; and Xavier Becerra, a former congressman who had been sworn in as attorney general of California only a day earlier.

Unrecognized so far from home, and little known to one another, the men spent a Wednesday evening late in January discussing a range of White House policies that might unsettle their states, including a mass deportation of unauthorized immigrants.

They never anticipated that a live-fire test of their teamwork would come less than 48 hours later.

Mr. Trump’s Jan. 27 decree on immigration, shutting off entry to the United States from seven overwhelmingly Muslim countries and halting refugee admissions, left states and cities scrambling to respond. Amid mounting protests and emotional scenes of disorder at American airports, it offered a galvanizing first challenge for a gang of Democratic attorneys general who have vowed to check the power of the White House.

In interviews, more than a dozen Democratic attorneys general, governors and party operatives detailed a week of frenzied litigation, late-night and early-morning phone calls and text messages, and strategies devised on airplanes and at sporting events. All told, Democrats say, the legal onslaught against Mr. Trump was a crystallizing moment for the party’s attorneys general — and a model for how to stall or unwind the administration policies they find most offensive.