Walmart said it was “surprised and deeply disturbed” to learn that one of its former Texas stores was being used to house migrant children who had been separated from their parents. “We sold the building in 2016 to a developer and had no knowledge then of its intended use today,” the giant retailer said in a Twitter post last week.

But real estate records pointed to the potential use. A Walmart executive signed a document that indicated the buyer was purchasing the property with a $4.5 million loan from a nonprofit that runs shelters for migrant children.

The nonprofit, Southwest Key Programs, now leases the roughly 200,000-square-foot building in Brownsville, Tex., that houses nearly 1,500 migrant children, many of whom have crossed the border seeking refuge alone or with their families.

When Walmart sold the building, Southwest Key was relatively unknown, even though for decades it had been running shelters for migrant children, as well as a juvenile justice program. The shelters have only recently provoked intense criticism after they began housing increasing numbers of children who had been separated from their parents as part of an aggressive crackdown on illegal immigration by President Trump.