WASHINGTON — In the wake of the largest-ever immigration raid in a single state, child welfare services were left grappling with children who came home from school to find their parents had been arrested at one of the seven Mississippi food processing plants targeted by U.S. Immigration and Customs Enforcement on Wednesday.

The agency said it took some precautions to ease the burden on families, but as one ICE official said, "We are a law enforcement agency, not a social services agency." The official said that any advance notice to welfare agencies or schools could have alerted undocumented immigrants to the raid and botched the operation.

President Donald Trump, speaking to reporters on the White House South Lawn before traveling to New York for a pair of fundraisers, echoed those concerns when asked why there wasn't a better plan in place to take care of the children.

"The reason is because you have to go in, you can't let anybody know, otherwise when you get there, nobody will be there," Trump said.

"But I want people to know that if they come into the United States illegally, they are getting out," Trump added. "They're going to be brought out. And this serves as a very good deterrent."

Trump decried the county's immigration laws, saying undocumented immigrants "may get in but it doesn't matter, because they're going out."

"And when people see what they saw yesterday, and like they will they'll see for a long time, they'll know that they're not staying here," the president said.

The Mississippi raids swept up almost 700 workers from six plants. Of those detained, 342 were from the Koch Foods and PH Foods facilities in Morton, Miss., 252 from PECO plants in Canton, Bay Springs and Sebastopol, and 86 from Pearl River Foods in Carthage. There were no arrests at a seventh plant because no workers were present.

Because of the lack of preparation for the impact of missing parents, local authorities had to improvise. One school district said it instructed bus drivers to make sure they saw a parent or a guardian at the bus stop before dropping off a child. In that district, children without parents at home were taken back to school to spend the night.

"What I saw was traumatic, painful," said Elizabeth Iraheta, who witnessed the raid on a food processing plant where she works in Morton. "I'm thinking of the separated families, fathers and mothers deported, children left alone because their parents were arrested."

The stories echo similar actions by the Trump administration, such as separating children from their parents at the border and leaving children in unsanitary conditions in border stations, that have had an outsize impact on young children and families.

Two ICE officials told NBC News they took the following steps out of concern for families:

Some parents of young children released: About 30 people were released at their workplace, rather than being taken into custody. The officials said many of these releases were done out of concerns that the parents had "tender-age" children under the age of five, living at home with no one else to care for them. But the officials could not guarantee that all parents with tender-age children were released. A phone call: Immigrants taken in for processing were each allowed to make a phone call. The officials said they believed this would be the opportunity for parents to call neighbors or relatives who could provide child care. Over 270 parents released quickly: While over 300 immigrants remain in custody from the raids, roughly 270 were given court dates and released within a day. The ICE officials said many of the decisions to release were made because of "custody determinations," such as the parent explaining no one else was home to take care of their children. Notifying schools: As soon as the raids were underway, schools across the area were notified that some of their students could be affected.

What they did not do:

Notify child protective services: The Mississippi Child Protective Services department said it was not notified in advance of the raids and that it should have been told in order to do its job. ICE officials said they were under no obligation to notify the agency and said doing so might have tipped off immigrants of their plans. Another ICE official told NBC News that ICE officers have taken a child welfare worker with them to homes during raids if they know a child may be left unaccompanied. Health and Human Services, which takes in unaccompanied migrant children, most often at the southern border, also said it has not received any referrals related to the raids in Mississippi. Tell schools in advance: Tony McGee, a school superintendent in a district where approximately 15 families were affected by the ICE raids, said his school was not given notice in advance. He said some parents were not at home when children left school that day. Local organizations stepped in to make sure the children had a safe place to go after school. It was the first day of school for many school districts across Mississippi. Guarantee that every child went home to a house with a guardian: The ICE officials said ICE could not make sure all parents of children had been released or that all children had a safe place to go after school. There were no plans in place to alleviate this risk entirely. "We are not a humanitarian agency, but we are trying our best to ameliorate the humanitarian concerns," one of the officials said.

Past immigration raids have provided little evidence that there is a codified system in place to deal with children left behind by the round ups.

In an April raid in Allen, Texas, about 280 people suspected of being in the U.S. illegally were arrested at a technology repair business. At the time, Katrina W. Berger, special agent in charge for Homeland Security Investigations' Dallas office, told The Dallas Morning News that those taken into custody were asked whether they were the sole caregivers of children and that those who answered "yes" would likely be released. CPS, she said, was seen as a last resort.

In many cases, however, the question of guardianship has been left to parents or extended family to figure out either preemptively or in reaction to a raid.

"Standby Guardian" laws, which allow for parents to choose their child's guardian, are one avenue for parents who anticipate potential detention or deportation.

In the wake of a 2018 raid on a meat processing plant in Tennessee, for example, several news outlets reported individuals had designated guardianship for their children by filling out power-of-attorney forms.