Some compulsively jump into the laps of strangers, or grab their legs and hold on for life. And some children, somehow, move past a sudden separation from their parents, tapping a well of resilience.

The Trump administration’s policy of separating migrant children from their parents has alarmed child psychologists and experts who study human development.

It is not clear how long the administration plans to hold onto the 2,000 children in detention centers near the border, nor how long before they are returned to their families.

But psychologists have learned a great deal about what happens to institutionalized children over time, and in that research there are clues to the potential emotional harms faced by migrant children severed from their parents.

A number of medical organizations, including those governing psychology, psychiatry and pediatrics, have issued letters of protest, citing an increased risk of anxiety and depression in the children, as well as post-traumatic stress and attention-deficit disorder.

Institutions — even the best and most humane — by their nature warp the attachments children long for, the visceral and concentrated exchange of love, tough and otherwise, that comforts, supports and shapes a child’s heart and mind.

In orphanages and other institutional settings, “turnover rate of caregivers is high, as is the number of children per caregiver,” Marinus van IJzendoorn, a professor of human development at Erasmus University Rotterdam, said in an email.

“This causes impersonal, unstable and fragmented care, which not only impacts on attachment or stress regulation but also on physical growth parameters such as height, weight and head circumference, and brain development.”

Children in institutions, Dr. van IJzendoorn continued, “bide their time hoping for better, personalized care that only families can provide.” Once these children enter foster care or are adopted, their development accelerates, and many catch up to peers within two or three years, Dr. van IJzendoorn said.

But much depends on how long they were held in detention: a longer stay at a later age requires the longest recovery period, he noted.

“So many of these parents are fleeing for their lives,” Dr. Colleen Kraft, president of the American Academy of Pediatrics, wrote in a public statement after a recent trip to the border. “So many of these children know no other adult than the parent who brought them here.”

Even the study of parental deprivation has been ethically fraught.

In the 1950s, the American psychologist Harry Harlow took young rhesus monkeys from their mothers and found that the youngsters became reclusive.

In one experiment, he found that they would quickly cling to “cloth mothers,” inanimate figures with a soft exterior. Those sad images still haunt the psychological literature.

Early in this century, American researchers working with Romanian officials found that children moved from that country’s notorious orphanages into foster care later had higher I.Q.’s on average than a comparison group of their peers deliberately left behind in the orphanages by the scientists.

Perhaps the most influential of them all, to modern child psychologists, was John Bowlby, the British scientist whose writings in the mid-20th century argued that infants were evolutionally primed to form attachments, not only for protection but also for emotional and cognitive development.

The quality of the primary attachment to (usually) a mother — whether strong and loving, uncertain, or absent — helps determine the trajectory of a child’s unfolding life.

Dr. Bowlby’s attachment theory informs many approaches to the treatment of children torn from their parents by circumstance or, in the case of current administration policy, by design.

Kalina Brabeck, a psychologist at Rhode Island College who works with immigrant children who lose their parents to deportation or for other reasons, said that the experience of loss often leads to a form of post-traumatic stress — the paralyzing vigilance, avoidance and emotional gusts first identified in war veterans.

Most of the children held on the border will have accumulated traumas, Dr. Brabeck said. Even before their parents were detained, many already had run the gauntlet of immigration itself, fleeing with little resources from often violent communities.

One goal of treatment, she said, is to overcome what is a daily identity crisis.

“We try to get them to tell a story: who they are, where they were born, what they’re good at, their migration story,” she said. “We may do that with pictures and drawings, as well as words — to walk through it in very detailed way.”

The therapy includes grief counseling, she said, and prodding the children to confront unconscious assumptions — for example, that the world is an inherently unsafe place. “We also work to connect them to other supports, like coaches, teachers and churches,” she said.

For all the dislocation, strangeness and pain of being separated forcibly from parents, many children can and do recover, said Mary Dozier, a professor of child development at the University of Delaware.

“Not all of them — some kids never recover,” Dr. Dozier said. “But I’ve been amazed at how well kids can do after institutionalization if they’re able to have responsive and nurturing care afterward.”

“The earlier they’re out, the better,” she added. “The most important thing for these children now is what we do next.”

Benedict Carey has been a science reporter for The Times since 2004. He has also written three books, “How We Learn” about the cognitive science of learning; “Poison Most Vial” and “Island of the Unknowns,” science mysteries for middle schoolers.

A version of this article appears in print on , on Page A15 of the New York edition with the headline: A Dicey Psychological Outlook for Migrant Children in Detention. Order Reprints | Today’s Paper | Subscribe