CHICAGO - A federal judge in Chicago on Thursday ordered the U.S. government to release a 9-year-old Brazilian boy who was separated from his mother at the U.S.-Mexico border, saying their continued separation "irreparably harms them both."

Judge Manish Shah mulled his decision for just a few hours before finding that Lidia Karine Souza can have custody of her son, Diogo, who has spent four weeks at a government-contracted shelter in Chicago. Shah ordered that the child be released Thursday, but didn't specify a time. Souza's attorneys said she would pick up her son Thursday afternoon.

The mother, who has applied for asylum, was released from an immigrant detention facility in Texas on June 9 and is living with relatives outside Boston.

"Judge Shah has vindicated the rule of law and taken a definitive step to allow Lidia's son to finally be with her again. We are hopeful that this outcome will benefit other families facing similar circumstances," attorneys Jesse Bless and Britt Miller said in a written statement.

Lidia Karine Souza and her son Diogo De Olivera Fi Lidia Karine Souza and her son Diogo De Olivera Filho smile at each other at the Mayer Brown law firm during a news conference shortly after Diogo was reunited with his mother, June 28, 2018, in Chicago. Lidia Karine Souza and her son Diogo De Olivera Filho smile at each other at the Mayer Brown law firm during a news conference shortly after Diogo was reunited with his mother, June 28, 2018, in Chicago.

Four hours

Shah, the son of immigrants from India, took just four hours before posting his written ruling after a hearing Thursday morning.

"Continued separation of ... (the) 9-year-old child, and Souza," he wrote, "irreparably harms them both."

The decision came two days after a different judge ordered the government to reunite more than 2,000 immigrant children with their families within 30 days, or 14 days for those younger than 5. White House spokeswoman Lindsay Walters declined to say Thursday whether the administration will be able to abide by the deadline. She said more than 500 children have been reunified with their families.

In Washington Thursday, police arrested nearly 600 people after hundreds of loudly chanting women demonstrated inside a Senate office building against Trump's immigration policy. Among those arrested was Rep. Pramila Jayapal, the Democrat from Washington state, she said on twitter.

Meanwhile, Melania Trump spent time with children at a complex in Phoenix where dozens of migrant children separated from their parents at the border are being held.

Weeks in quarantine

Souza's son has spent four weeks at a government-contracted shelter in Chicago, much of it alone in a room, quarantined with chickenpox. He spent his ninth birthday on Monday without his mom. Even after Tuesday's ruling in California, Souza's attorneys nonetheless moved forward with an emergency hearing in their lawsuit against the Trump administration.

Shah wrote that he understood that volume of paperwork, filings and forms normally required before the government can release a child in its custody are intended to ensure the child's well-being. But, he said, "the government's interests in completing certain procedures to be sure that (Souza's child) is placed in a safe environment and in managing the response to ongoing class litigation do not outweigh the family's interest in reuniting."

The fitness of the mother in this case isn't questioned, he said, so dragging out processing "only serves to interfere in the family's integrity with little to no benefit to the government's interests."

Souza has been allowed to phone her son for just 20 minutes per week. She has said he would beg her through tears to do everything in her power to get him back to her. The 27-year-old woman searched for weeks to find Diogo after the two were separated at the border in late May. When she was released, she filled out nearly 40 pages of documents that U.S. officials told her were required to regain custody.

Immigrants from Guatemala and Cuba seeking asylum Immigrants from Guatemala and Cuba seeking asylum in the United States wait on the Matamoros International Bridge, June 28, 2018, in Matamoros, Mexico. Immigrants from Guatemala and Cuba seeking asylum in the United States wait on the Matamoros International Bridge, June 28, 2018, in Matamoros, Mexico.

'This ... is a nightmare'

Then they told her that the rules had changed and that she needed any family members living with her in the United States to be fingerprinted and still more documents.

Government attorney Craig Oswald told Shah that U.S. officials have been "raked over the coals ... before" for not being thorough about such background checks, which he said are meant to ensure a child's safety.

Souza was seeking safety by coming to the U.S., but it's not the safety she sought for herself and her son. This was not the American dream.

"This ... is a nightmare," she said in an interview with The Associated Press on Wednesday.

For days and weeks now, some of the hundreds of parents separated from their children at the Mexican border by the Trump administration have been battling one of the world's most complex immigration systems to find their youngsters and get them back.

For many, it has been a lopsided battle, and a frustrating and heartbreaking one. Most do not speak English. Many know nothing about their children's whereabouts. And some say their calls to the government's 1-800 information hotline have gone unanswered.

Children spread out

Huge logistical challenges remain, and whether the U.S. government can manage to clear away the red tape, confusion and seeming lack of coordination and make the deadline remains to be seen.

Among the complicating factors: Children have been sent to shelters all over the United States, thousands of miles from the border. And perhaps hundreds of parents have been deported from the U.S. without their children.

Jesse Bless, an attorney from Jeff Goldman Immigration in Boston, one of two firms representing Souza, said some parents who are trying to get their children placed with friends or relatives in the U.S. are being asked by the government to provide, along with fingerprints of relatives, utility bills and lease information, which many newly arrived immigrants don't have.

Souza and her son were separated after she requested asylum, arguing her life was in danger in her native Brazil.

"I came out of necessity," she told the AP.

After her son was taken, she had no idea where he was until another detained mother said her child knew a boy named Diogo in a Chicago shelter. She had been told the soonest he could be released would be in late July.

Souza visited Diogo for the first time since May on Tuesday. They embraced, and she kissed him several times on the head and face, then grabbed his cheeks gently with her hands as they both cried.

"I missed you so much," she said in Portuguese.

Asked how he was, Diogo said: "I am better now."

Their visit lasted an hour. Then he returned to U.S. government custody.

"He cried a lot when the time came to say goodbye," she said. "He thought we would be taking him home."