EL PASO, Texas — The government was separating migrant parents from their kids for months prior to the official introduction of zero tolerance, running what a U.S. official called a "pilot program" for widespread prosecutions in Texas, but apparently did not create a clear system for parents to track or reunite with their kids.

Officials have said that at least 2,342 children were separated from their parents after being apprehended crossing the border unlawfully since May 5, when the Trump administration's "zero tolerance" policy towards migrants went into effect.

But numbers provided to NBC News by the Department of Homeland Security show that another 1,768 were separated from their parents between October 2016 and February 2018, bringing the total number of separated kids to more than 4,100.

More than 1,000 children were separated between October 2016 and September 2017, and 703 were separated between October 2017 and February 2018, according to DHS.

It's unclear how many of those 1,768 children were separated after President Donald Trump's inauguration in January 2017. NBC repeatedly asked DHS for comprehensive data, but the agency declined to provide month-by-month figures, did not provide data prior to October 2016 and did not supply any numbers for March and April 2018.

A DHS official told NBC News that the practice of dividing parents and kids predates the Trump presidency. "DHS has continued a long-standing policy by the previous administration," said the official, listing risk to the child and criminal prosecution of the parent as among the reasons for separation.

But the DHS official also confirmed to NBC that, from July 2017 to October 2017, the Trump administration ran what the official called a "pilot program" for zero tolerance in El Paso.

Court records and interviews with migrants show that during that period federal prosecutors began to criminally charge any adult who crossed the border unlawfully in the El Paso sector, which spans from New Mexico to West Texas. Parents arriving with young children were not exempt.

"This was happening in El Paso before it was news," said Linda Rivas, executive director of Las Americas Immigrant Advocacy Center. "People didn't believe it."

Central American asylum seekers wait as U.S. Border Patrol agents take them into custody near McAllen, Texas on June 12, 2018. John Moore / Getty Images

Records and interviews indicate that mothers and fathers, most from Honduras, El Salvador and Guatemala, went to jail on charges of misdemeanor illegal entry or felony re-entry. Their children were reclassified as "unaccompanied" and sent into a network of shelters scattered across the country run by the U.S. Department of Health and Human Services, which oversees the care of unaccompanied migrant children apprehended by the government.

Even those families who crossed the border hoping for asylum were caught up in the El Paso experiment. A mother named Jocelyn, whom Rivas represents, was apprehended crossing with her son last August near El Paso. Although Jocelyn said she sought asylum, she was prosecuted for illegal entry, court documents show. Her son was taken from her and sent to a shelter in Chicago. She told NBC News that nearly two months passed before she had any news of him, and she waited nine months before they were reunited.

"It's something that it's difficult to forget," Jocelyn said. "It will be with us for a very long time. We looked for protection and then this horrible thing happened."

Jocelyn and another migrant mother detained in San Diego became plaintiffs in a lawsuit filed by the ACLU against the federal government. This week, U.S. District Judge Dana Sabraw granted a preliminary injunction sought by the ACLU in the suit, mandating that all children affected by the "zero tolerance" policy be reunited with their parents within 30 days. He also ordered that within 10 days, parents be allowed a phone call with their children.

Prior administrations had avoided prosecuting parents who arrived with children, in particular mothers, because bringing criminal charges meant they would be jailed and their children sent to a shelter. But months before the pilot program launched in El Paso, Trump administration officials had indicated that breaking up parents and children could be an effective way to reduce the escalating numbers of families arriving at the border from the impoverished and violent countries in Central America's Northern Triangle.

The idea of separating migrant children from their mothers was discussed during the earliest days of the administration as a way to deter asylum-seekers, according to notes from an asylum officers' meeting.

At a town hall for Citizenship and Immigration Services asylum officers on Feb. 2, 2017, the agency's asylum chief, John Lafferty, told officers they might have to "hold mothers longer" and "hold children in HHR/ORR," an acronym for childrens' facilities run by HHS.

The next month, then-Homeland Security Secretary John Kelly told CNN he was considering separating families caught crossing the border "to deter more movement along this terribly dangerous network."

In a hearing before the Senate's Homeland Security Committee on April 5, 2017, Sen. Heidi Heitkamp, D.-N.D., asked Kelly if the agency planned to take children from mothers they apprehended crossing the border.

"Only if the situation at that point in time requires it," said Kelly. "Not routinely."

"If you thought the child was endangered, that's the only circumstance to which you would separate," Heitkamp said.

"Can't imagine doing it otherwise," Kelly replied.

But in July, as Kelly left his post at DHS to become President Donald Trump's chief of staff, the department launched its experiment in El Paso.

There was no official announcement. But late last summer, attorneys and advocates in this border city heard increasing numbers of migrants talk of their children being taken away — and having no idea where they were.

"It was just like a switch, you saw it happen overnight," said Jessie Miles, an immigration lawyer in El Paso and member of the Borderland Immigration Council, a coalition of immigration attorneys and advocates.

Attorneys with the Federal Public Defender's office in El Paso, which normally handles felonies, began to step in on misdemeanor illegal entry cases. Even on this part of the border, where immigration prosecutions have long been common, attorneys were stunned by how many shackled migrants began to shuffle into district court.

Typically, said Sandra Lewis, an El Paso federal public defender, the first question she'd get from her clients was about their own fate. Last fall, that changed.

"There was a shift from, 'What is going to happen to me,' to 'Where is my child?'" said Lewis.

Distress also grew among groups that care for unaccompanied children. Before last spring, staff at Lutheran Immigration and Refugee Services, a nonprofit that runs foster care programs for unaccompanied migrant children in federal custody, had seen the occasional separation, often when parents could not prove that the child they traveled with was their own.

"In May 2017, we started seeing cases of children who had been intentionally separated from people who were clearly their parents," said Danielle Bernard, director of communications at LIRS.

The numbers at LIRS started small, Bernard said. One case in May, another in June. In July, it spiked to seven. In August, it was 10, then 12 in November. In December, LIRS joined several other rights organizations to file a complaint with the DHS inspector general noting the "alarming" number of migrant families forcibly separated after crossing the border.

Back in El Paso, some began to wonder if the separations were a fluke, or a new policy.

A Honduran family seeking asylum wakes up on the Mexican side of the Brownsville-Matamoros International Bridge after spending the night after U.S. Customs and Border Protection officers denied them entry near Brownsville, Texas, on June 25. Loren Elliott / Reuters

On Oct. 24, advocates, attorneys and faith leaders in El Paso sat down with government officials for a meeting about immigration. More than two dozen people gathered around a large table at a meeting coordinated by local Rep. Beto O'Rourke's office, according to five people who were present.

Representatives from CBP, Immigration and Customs Enforcement and DHS attended. Maureen Franco, the head of the Federal Public Defender's office in El Paso, told the group her office had received a striking number of family separation cases. What, she asked the federal officials, was the current policy involving the prosecution and separation of parents arriving with children?

A Border Patrol agent fielded the question, according to Jessie Miles, who was there on behalf of the Borderland Immigration Council. "His response was, the new policy is that we can separate children as long as they are 10 or over," she recalled. "To which Maureen responded, 'What do you mean? I have a client with a four-year-old.'"

"The whole room collectively gasped," said Miles.

The following afternoon, those who'd attended the meeting got an email from Lisa Donaldson, an attorney in the Office of Assistant Chief Counsel for CBP. She wanted to clarify comments "pertaining to separation of family units" at the meeting.

"The Border Patrol does not have a blanket policy requiring the separation of family units," she wrote in the email, which was reviewed by NBC. "Any increase in separated family units is due primarily to the increase in prosecutions of immigration related crimes."

Immigrant children housed in a tent encampment under the new "zero tolerance" policy by the Trump administration walk in single file at the facility near the Mexican border in Tornillo, Texas on June 19, 2018. Mike Blake / Reuters

In response to questions from NBC, a spokesman for CBP reiterated that position. Prior to zero tolerance, he said, CBP had no policy of separating families for reasons other than medical need, fraud or criminal cases, which could include criminal immigration violations.

Three days after the meeting, the El Paso pilot program ended, according to a DHS official. It was deemed a success. A bar graph reviewed by NBC noted that in October 2017, the last month of the program, the El Paso sector saw a 64 percent drop in apprehensions compared to the prior October.

The El Paso experiment would be used by ICE, CBP and Customs and Immigration Services to encourage DHS Secretary Kirstjen Nielsen to launch a zero-tolerance program across the entire Southwest border, according to an April memo obtained by the Washington Post. According to the Post, the memo attributed the 64 percent drop in apprehensions "to the prosecution of adults . . . for illegal entry," adding, "Of note, the numbers began rising again after the initiative was paused."

But at least one federal judge was troubled by consequences of the pilot program that he had seen in his courtroom.

On Nov. 1, six months before Attorney General Sessions officially implemented "zero tolerance," Magistrate Judge Miguel A. Torres expressed frustration from the bench in El Paso about the number of defendants who had been separated from their children and had no word of where they were.

In a hearing involving five such defendants, Judge Torres questioned the lack of information provided to parents.

"I've been troubled that by the time of their pleas they don't have this information," said Torres in audio obtained by NBC News. "It is an anxiety that looms large."

On June 8, more than six months later, another parent appeared before Torres.

The Guatemalan man had been separated from his 10-year-old daughter and charged with re-entering the U.S. illegally after being deported. Lewis, his federal public defender, was asking the judge to grant bail. She said the government had given her client no information about where his daughter was — not even the 1-800 number now given to parents searching for their children.

By that time, some 2,300 children had been separated from their parents since the implementation of zero tolerance in May. Torres was incredulous that parents continued to be locked in jail without any word of where their kids were.

Children, with their faces covered with masks, leave the Cayuga Center, which provides foster care and other services to immigrant children separated from their families, in New York on June 21, 2018. Mike Segar / Reuters

"I cannot believe that the process isn't even explained," Judge Torres said. "[Y]ou don't get any kind of notification or any kind of explanation about what your process is. I don't understand that."

A week later, Judge Sabraw issued the injunction in Jocelyn's case, about ten months after she had been separated from her son in El Paso. His order echoed Torres's incredulity that the government had broken up families without any plan for putting them back together.

"The unfortunate reality is that under the present system migrant children are not accounted for with the same efficiency and accuracy as property," he wrote. "Certainly, that cannot satisfy the requirements of due process."

On June 20, Trump signed an executive order to "maintain family unity," effectively halting separations.

The government is now asking the Department of Defense to find space for 12,000 beds to detain families together along the border.

In that regard, El Paso may again be a pilot program — one of the bases being considered is Fort Bliss.

To advocates here, it was not an acceptable compromise.

"Family detention is not the solution," said Taylor Levy, the legal coordinator at Annunciation House, which houses and assists migrants in El Paso. "ChIldren do not belong in detention. Babies do not belong in detention."