Begging. Blacking boots. Dodging angry, drunken adults. Living on the street. The 35 children who gathered at New York’s Children’s Aid Society in 1880 all had stories of deprivation and abuse to tell. Now, their ragged clothes had been stripped from them and replaced with sturdy new clothing and coats by aid workers. It was time for a long journey west.

“No mother’s tears were shed over the departing waifs,” wrote a reporter from the New York Daily Tribune, “no father’s counsel was given to the boys who were about to enter upon a new life.” That new life awaited them in Iowa, where they would arrive after a days-long train trip that swept them from urban New York to the rural Midwest. There, the Children’s Aid Society workers hoped, they would be adopted by families and put to work in fields and on farms.

They were part of what is now known as the orphan train movement, a sweeping attempt to protect homeless, poor and orphaned children in a time before social welfare or foster care. Organized by reformers in the Eastern United States, the program swept children westward in an attempt to both remove them from the squalor and poverty of the city and help provide labor for farms out west. Between 1854 and 1929, up to 200,000 children were placed on the trains and adopted by new families. But though many children did ride to better lives on orphan trains, others did not.

Orphan trains were the brainchild of Charles Loring Brace, a minister who was troubled by the large number of homeless and impoverished children in New York. A massive influx of new immigrants had crowded the city, and a series of financial panics and depressions in the late 19th century created unemployment. Meanwhile, cheap housing became harder to come by. As a result, tens of thousands of destitute children ended up on the street. Since there was no social safety net, there was no organized way to reach individual children or provide them with welfare or social services. Brace wanted to change that.

Characterized by Brace as belonging to the “dangerous classes,” these neglected children begged outright or performed small services like shining shoes and selling newspapers. They were often arrested for vagrancy or petty theft and thrown into prison along with adults. In an attempt to help them, Brace founded the Children’s Aid Society in 1853. Devoted to “vagrant children,” the society created trade schools, built lodging houses for homeless children, and began to tackle truancy and illiteracy.

READ MORE: These Appalling Images Exposed Child Labor in America

Brace believed that the city was no place for a desperately poor child, and as the numbers of homeless children began to grow—between 20,000 and 30,000 in the 1870s alone—he started acting on that belief. Brace proposed that orphans and indigent children be sent to families in the West instead of institutionalizing them.

“The best of all Asylums for the outcast child, is the farmer's home,” Brace wrote. He called it “Emigration as a cure for Pauperism.” Since farmers needed every set of hands they could find, he argued, and since food and space was plentiful in the burgeoning West, it made sense to send children there instead of locking them up on the East Coast.

With the help of funds donated by New York’s wealthiest families, Brace and other organizers began gathering groups of children and sending them west. In the parlance of the time, it was known as “placing out.” The process varied, but usually included pairing groups of children with adult chaperones who rode with them to rural destinations.

When they arrived, the chaperones would take the children to large public gatherings, often advertised with posters, during which potential adoptive parents would select a child or children. Then, they would go to their new homes with the understanding that they would be expected to work on the farm in exchange for their home. Most parents signed agreements that entitled the children to care, but allowed them to leave the home if circumstances necessitated a break in the adoptive relationship. Not all orphan train riders went to an unknown destination: Some had been pre-placed already and rode the train to a pre-designated home.

Jacob A. Riis/Museum of the City of New York/Getty Images
A group outside of the Children's Aid Society's central office in New York City, circa 1895. The children hold satchels with their belongings as they prepare to travel west.

By modern standards, the process of placing children with strangers during what amounted to a mass adoption event would be considered cruel and dangerous. Vetting was lax, if potential parents were vetted at all, and some children were placed with people who treated them as servants. Sibling groups could be separated, and children whose new guardians died or abandoned them could relive the circumstances that took them west in the first place, falling back into neglect, poverty or crime.

Not all of the children who were sent on orphan trains were actually orphans. Some, like Hazelle Latimer, were sent away regardless of the fact that their parents were living: “I’d just finished eating and this matron came by and tapped us along the head. ‘You’re going to Texas. You’re going to Texas.’ When she came to me, I looked up. I said, ‘I can’t go. I’m not an orphan. My mother’s still living. She’s in a hospital right here in New York.’ ‘You’re going to Texas.’ No use arguing,” she recalled.

Others were given over to aid workers by parents who knew they could not support them in the city. “Impoverished but resourceful parents took advantage of the services of middle-class child-savers for their own purposes, including temporary caretaking during periods of economic crisis,” writes historian Ellen Herman. Those children retained ties to their birth families, and many stayed only temporarily in the West. Others, though, took on new names and identities and never returned to New York.

The system Brace had masterminded ended up being in place for 75 years. As historian Rebecca S. Trammell writes, the movement came to an end not just because of a slowdown in the need for farm laborers, but a backlash from states that no longer welcomed children they saw as potentially criminal. By the 1920s, social work had become a profession, and as the nation moved away from child labor and toward a social welfare system, the trains were no longer seen as necessary.

Today, there are more homeless children in New York than in the 1870s, but the city has grown from around 942,000 residents to over 8.6 million. Though social services do place children with foster families, they do so in the same geographical areas where children have grown up, and children are no longer expected to perform grueling labor in exchange for foster care or adoption.