“The mafia said if my client didn't work for them they'd rape his six-year-old son,” she said. “So his only decision was to get to the US. Am I going to leave my child? No, I'm going to bring my child. Anybody would.”

One Tucson-based lawyer, who did not wish to be named, described a client who crossed illegally only after being blocked from seeking asylum at a US port of entry.

Many of those arrested try to claim asylum because they are fleeing from gang violence, corruption, political instability and natural disasters. Those opting to seek asylum the “legal” way, by presenting themselves at a US port of entry, have been thwarted by officials who say they don’t have the capacity to process them. Border Patrol has started blocking anyone without a US passport from stepping onto US soil, leaving a backlog of asylum seekers camping on international bridges between the US and Mexico for weeks as they wait to be processed.

The Otero county sheriff’s department dispatched Border Patrol agents who transported the men to a local hospital for treatment. Marin was then taken to the Alamogordo Border Patrol station for processing, and charged with felony re-entry. He pleaded guilty and was sentenced to 57 days in federal prison.

“Please come get us,” the men can be heard asking in the 911 call, which the Guardian obtained through a public records request. They ask repeatedly for water.

In some cases, migrants end up turning themselves in. On 16 May, Marin M, a migrant from Guatemala, called 911 from the desert in Otero county, New Mexico, when he and his traveling companions found they could walk no farther.

Others were arrested at motels, based on anonymous tips or pro-active surveillance. In one case, border patrol agents were surveilling the Cotton Valley Motel in Clint, Texas. After observing “two individuals wet and muddy from the knees down” enter, the agents obtained consent from the motel manager to search the room, where they found six people hiding in the bathroom.

At least six migrants were arrested during “immigration inspections” of commercial passenger buses at a border patrol checkpoint in Texas – a practice that has been harshly criticized as unconstitutional by the American Civil Liberties Union, which is calling on Greyhound buses to stop allowing border patrol agents on board. All six have pleaded guilty; three received prison sentences ranging from 64 days to four months; the other three are still awaiting sentencing.

Border Patrol uses an armory of technology including “seismic intrusion devices” (sensors that send an alert when they detect the vibrations created by footstep), giant towers packed with cameras and sensors, and mobile video surveillance systems – trucks that have extendable masts fitted with an array of cameras, radar and laser range finders, frequently referred to as “scope trucks”.

The documents reveal the lengths to which the US Border Patrol and Immigration and Customs Enforcement (Ice) go to capture migrants.

As zero tolerance went into effect, federal courtrooms along the border were beset by an atmosphere of chaos and desperation, dozens of attorneys, judges and advocates told the Guardian.

“People were panicking,” recalled Carlos Quinonez, a defense attorney in El Paso, Texas. “I've never seen so many people.”

“It was a shock for everyone,” said Daniela Chisolm, another El Paso attorney. “You had 75 people in chains: 18-year-old girls from Guatemala, 70-year-old men from Honduras … The first day, I had 15 clients, and nine of them had children taken from them.”

Defense attorneys spoke of an “exponential” increase in the number of cases they were assigned, made all the more challenging by their clients’ anxiety after losing their children. “I spent a lot of time having to refocus my clients,” said Quinonez. “They were focused on where their kids were.”

While federal public defenders usually represent indigent defendants charged with felonies, the task of representing the thousands of misdemeanor illegal entry cases often fell to private defense attorneys like Quinonez and Chisolm, whose fees the government pays. Pierce, the Las Cruces defense attorney, said he came to consider those payments “blood money”. “We get paid to do this, but it’s not really what we signed up for,” he said. “You want to defend people in a criminal case, not because someone crossed the border looking for work.”

Maxine Dobro, a defense attorney in San Diego, was one of several defense attorneys to express disgust with what she called “a misguided decision by a misguided administration: the mass scooping up of minnows will go down as one of the darkest hours of our nation.”

“The sharks swim away and the minnows are prosecuted,” she added. Indeed, an analysis by the Transactional Records Access Clearinghouse found that between March 2018 and June 2018, federal prosecutions of non-immigration crimes fell in the five border districts, both as a percentage of total prosecutions and in absolute terms.

Some defense attorneys, including Jose Troche, an El Paso attorney who represented 11 clients in our sample, were supportive of zero tolerance. “Look, I represent them, but some of these parents need to be prosecuted for child endangerment,” Troche said. “They brought these kids through Mexico, through that pigsty, and dumped them here.” As for the children themselves: “The centers are the safest place these kids have ever been,” he said.

While defense attorneys were struggling to represent the thousands of newly criminalized migrants, federal prosecutors had challenges of their own. In at least 15 cases, the criminal complaints charging migrants with illegal entry included obvious errors suggesting that whoever had filled them out had failed to complete a prepared template.

Ananias B, a migrant from Honduras, was charged with entering the country by “wading the Rio Grande River near, #PLACE OF ENTRY#”. Angel A, from El Salvador, was charged with a crime that “took place on #DATE OF ENTRY#”. Perhaps most egregiously, seven migrants in Arizona were charged based on complaints that included the phrase, “Agents observed the Defendant #DOING WHAT? PICK ONE DELETE THE REST#”, followed by a list of apparently common behaviors.

The Guardian made numerous attempts to contact the federal prosecutors responsible for prosecuting the cases in our sample. None agreed to speak either on or off the record.

Cosme Lopez, a spokesman for the US attorney’s office in Arizona, said by email that one of the incomplete complaints had been filed with Pacer “due to an apparent error in the uploading process”. Lopez said that a “hard copy” was used in court “that included all the necessary information.” Lopez declined to provide a copy of this hard copy, and neither responded to questions regarding the uploading error nor explained how the document in Pacer came to be signed by a judge.

One federal magistrate judge who has handled zero tolerance cases and who spoke to the Guardian on condition of anonymity said that the incomplete complaints certainly represented “shoddy work”, but added that he would not “ascribe to it any sinister motives”.

The mass scooping up of minnows will go down as one of the darkest hours of our nation Maxine Dobro, defense attorney

He compared the criminal justice system to a boa constrictor that can open its mouth wider and wider to swallow increasing numbers of defendants, but cannot increase its capacity to digest those cases. “Historically, the government puts lots of resources into the law enforcement mouth, but the judicial resources to address that lump of new cases don’t get increased correspondingly,” he said.

That judge, like others who spoke with the Guardian, described a dramatic increase in misdemeanor and petty offenses in his courtroom. William P Johnson, the chief US district judge of New Mexico, shared with the Guardian a letter he had sent seeking authorization to fill a vacant magistrate judge position in which he highlighted the “drastic increase” of 1,100% in misdemeanor illegal entry cases from 2017 to 2018.

Within the pages of the more than 6,000 court documents the Guardian examined there is a striking omission: the fact that many migrants were travelling with children at the time of their arrests was recorded in only 10 of the 3,121 cases we examined.

José G is one of those 10. When he appeared in court on 14 May, five days after his apprehension by Border Patrol, the criminal complaint against him included a reference to his child. The fact that his son was in the US, and by then was being kept in a shelter for migrant children in El Paso, was not referenced in the prosecution’s motion asking a judge to deem José a flight risk and detain him without bond – a request that the judge in the case granted.

José spent two months in the El Paso county jail before the case against him was simply dropped. The prosecution’s motion for the case to be dismissed states only that “the government does not wish to prosecute at this time”. José was moved to an immigration detention center to start the separate process of immigration court. He did not pass the “credible fear” interview that would have allowed him to seek asylum.

He is yet to be reunited with Marco.