LOS ANGELES — The Trump administration’s failed attempt to detain migrant families together indefinitely ran into a formidable obstacle in a judge whose upbringing was shaped as the daughter of immigrants and who previously rejected requests to allow the government to lock up children with their parents.

Judge Dolly Gee, the first Chinese-American woman appointed to the U.S. District Court, has joked that her mother was her first pro bono client because she had to translate for her at medical appointments and help her apply for jobs as a seamstress when she was just a girl.

“She in many ways inspired my desire to go to law school,” Gee said in a video produced by the National Asian Pacific American Bar Association. “I saw firsthand the difficulties she encountered as a non-English speaker and also as a garment worker. And I saw many of the abuses that take place in the workplace, and I decided at a fairly early age that I wanted to do some type of work that would address some of the inequities I saw as a child.”

On Monday, Gee rejected the Trump administration’s efforts to detain immigrant families in long-term facilities, calling it a “cynical attempt” to undo a longstanding court settlement.

The U.S. Justice Department said it disagreed with the ruling and was reviewing it further.

Gee, 59, worked for years as a labor lawyer and arbitrator before applying to be a judge in what she saw as a chance to diversify the court.

President Bill Clinton nominated her in 1999, but the GOP-controlled Senate dragged its feet and Gee never received a hearing before the Senate Judiciary Committee. President Barack Obama nominated her a decade later, and she was confirmed and took her seat in Los Angeles in 2010.

Although Gee has handled hundreds of cases, she is best known for a series of decisions on immigration in which she has often ruled against the government.

Overseeing a longstanding settlement between the government and immigration advocates over the detention of minors, Gee ruled in 2015 that immigrant children should not be held for long periods — generally no longer than 20 days — even with their parents. She said they should be released as quickly as possible, typically to a relative.

In sharply worded rulings in the case, Gee scolded the Obama administration for holding children in “widespread and deplorable conditions,” and she dismissed a request to reconsider a decision at one point, noting the government had “reheated and repackaged” its arguments. The 9th U.S. Circuit Court of Appeals largely upheld her ruling but said its agreement didn’t require the release of parents with their children.

Last month, Attorney General Jeff Sessions asked Gee to modify her order so families that entered the country illegally could be held together indefinitely. The move followed the president’s reversal of a policy that created an uproar when children were taken from their parents in emotional scenes caught on camera.

The government said in court papers that Gee’s previous ruling made family detention unlikely and provided an incentive for immigrants to bring children with the expectation they wouldn’t be locked up.

“One reason those families ‘decide to make the dangerous journey to illegally enter the United States is that they expect to be released from custody,'” the government said, quoting an official with U.S. Immigration and Customs Enforcement.

Gee described the government’s request as a “cynical attempt” to foist responsibility on her for the president’s “ill-considered” action and Congress’ failure to address the issue for over 20 years. She said it was “procedurally improper and wholly without merit.”

Gee made a landmark ruling in another case in 2013 that gave mentally disabled immigrants the right to legal representation if they were detained and facing deportation. It was the first time a court required legal assistance for any group, including children, in immigration courts.

And during the early days of President Donald Trump’s travel ban targeting Muslim-majority countries, Gee ordered the return of an Iranian man who was removed from the U.S. upon his arrival despite having a valid visa.

Jean Reisz, a law professor and co-director of the immigration law clinic at the University of Southern California, said what’s unusual about Gee’s rulings is that she’s waded into the thorny topic of immigration, where the government has broad authority.

“Her strong language was kind of a welcome reprieve in a climate where discretion’s largely left to the attorney general and not reviewed by the judiciary,” Reisz said. “Most judges weren’t taking those positions.”

Attorney Michael Steinberg, a lead lawyer on the case involving immigrants with mental disabilities, said Gee was careful, thoughtful and respectful but made her point clear, even when it was subtle.

Before she became a judge, Gee was known for her work fighting for underdogs. She investigated workplace and racial discrimination and sexual harassment and worked on behalf of labor unions, though she also represented employers in some cases.

“She has used her position as a prominent attorney in Los Angeles to promote racial tolerance and fight for justice for those who face discrimination,” former Sen. Barbara Boxer, a California Democrat, said in a statement after the Senate confirmed Gee.

Gee said she was often underestimated early in her career because she looked much younger than she was and stood only 4-foot-11 (150 centimeters).

Her first assignment as a law firm associate sent her to a butcher’s union hall where the president was a “huge guy” who towered over her.

“He said, ‘So you’re the lawyer?'” she recalled in the interview with the bar association, part of a series on prominent members. “I said, ‘I sure as hell am.”

Once they got down to business, she said his “perceptions melted away.”

Your support matters…

Independent journalism is under threat and overshadowed by heavily funded mainstream media.

You can help level the playing field. Become a member.

Your tax-deductible contribution keeps us digging beneath the headlines to give you thought-provoking, investigative reporting and analysis that unearths what's really happening- without compromise.

Give today to support our courageous, independent journalists.