IT IS the drowsy after-lunch slot in one of San Antonio’s immigration courts, housed anonymously on the third floor of a squat brown office building, when the case of Pedro Rochas begins. Most of the men who appear before immigration courts tend to favour hardly worn suits with matching shoes, as if going to church. Mr Rochas, a slight 33-year-old, is dressed less smartly in jeans and a red sweatshirt. He came to America at 16 and works as a part-time cook in a retirement home in Cedar Park, a town on the outskirts of Austin, where he met his wife. They have three children, all born in America. The offence that placed Mr Rochas in court on a cold day just before Thanksgiving was the purchase of a Social Security card, which allowed him to get work. He will probably be deported for it.

Last year America removed 369,000 undocumented migrants, an increase of nine times compared with 20 years ago (see chart 1). This takes the total number of the deported to almost 2m in Barack Obama’s presidency.

While this has been going on, the number of people entering America illegally via the south-western border has dropped. There are no official numbers on how many people become illegal immigrants by overstaying their visas. But the data that are collected, combined with estimates to fill the gaps, suggest that in the past couple of years, for the first time since people started to talk about illegal migration, the outflow has been greater than the inflow.

On one measure this is a great success. It is hard to find many areas where the federal government is so effective in implementing laws passed by Congress. Yet it is harmful—not just for the deported, who often have a miserable time once they are expelled (see article), but for the country they leave behind, something which even the deporters have come to recognise.

It is also a political problem for Mr Obama. The president was heckled while giving a speech on immigration in California in November by a man who shouted that he had the authority to halt the deportations and ought to use it. “Actually, I don’t,” replied Mr Obama: an unusual thing for a president to say. At the other end of the political spectrum, his administration is criticised for not deporting enough people. When the deportation numbers for 2013 were released Bob Goodlatte, the chair of the House Judiciary Committee, said that the slight decline compared with the year before was “just more evidence that the Obama administration refuses to enforce our immigration laws.”

How has a president who campaigned hard on migration reform come to preside over the expulsion of more migrants than ever? The government has long had the authority to expel undocumented migrants, but deporting them all is impractical (there are reckoned to be 11.7m). It has therefore chosen to concentrate on getting rid of criminals. This category is more elastic than it might seem. It was expanded in 1996, when a Republican-controlled Congress passed a tough immigration law and illegal border crossings were running at four times their current level.

That law reclassified several misdemeanours as “aggravated felonies” if they were committed by an illegal immigrant, lowering the legal barriers to deportation. The expanded list included stumbles that undocumented migrants are quite likely to make, such as failing to appear in court or having fake papers. It also removed time limits on these offences, so that crimes committed by teenagers could lead to deportation 20 years later. One government lawyer in San Antonio says that some of the cases he argues stretch back decades. “You can be in your 40s or 50s and have a marijuana conviction from 20 years ago and be deported for it,” explains Doris Meissner of the non-partisan Migration Policy Institute.

The effects of this change in the law were limited at first. The year after it passed 115,000 people were deported. This is because the means to enforce it were not available. That changed after the September 11th 2001 terrorist attacks when, by an odd jump of logic, a mass murder committed by mostly Saudi terrorists resulted in an almost limitless amount of money being made available for the deportation of Mexican house-painters. America now spends more money on immigration enforcement than on all the other main federal law-enforcement agencies combined (see chart 2). Much of that spending has created a border agency that can operate throughout the country. Before the September 11th 2001 attacks it was considered a threat to liberty for agencies to share too much information. After the report of the 9/11 Commission the opposite became true. The result is that Immigration and Customs Enforcement (ICE), the agency charged with doing the deporting, can now quickly determine whether someone serving a prison sentence for a serious crime is eligible to be deported when their time is up. More controversially, it also allows ICE to see whether someone charged by the police with relatively minor offences can also be deported. Of the 369,000 people deported last year, roughly two-thirds were people who had been stopped while trying to cross the border. The rest—134,000 of them—were picked up in the interior of the country. One of them was Adrian Revuelta, 29, who had lived in Oklahoma for ten years and worked at IHOP, a pancake house, before being deported for driving without a licence. In jail, he says, his documents were torn up and his contact numbers, jacket and cap were thrown in the bin. Worst of all was his criminal record: “It means I can never go back.” Yet all the time, he says, his brain is full of memories of his friends and colleagues in Oklahoma. On Facebook, he winces when people he knows talk about meeting at Denny’s, or to play soccer. “It is like a knife stuck in my side,” he says. “The way you are treated is not human.” The turning of police officers into immigration officials has brought border enforcement into areas of the country far from the deserts of the south-west. Secure Communities, the name given to the programme that links police work to the immigration database, began life in a single jurisdiction in Texas in 2008 at the end of George W. Bush’s presidency. By May 2013 it was operating everywhere.

This worries some policemen. “I would sooner see Secure Communities go away,” says Mark Curran, an Illinois sheriff. He thinks that the programme makes policing harder because it erodes trust between his officers and the people they are supposed to police. Anecdotal evidence suggests that people are more likely to flee the scene of a car crash in places where there are lots of undocumented migrants to avoid being asked for their papers. Some people take more drastic steps to avoid triggering a match on the database. In November ICE arrested a doctor in Boston who flew in regularly from the Dominican Republic to alter fingerprints. A full set of unrecognisable fingertips cost $4,500.

While the police have been tracking down migrants, the Department for Homeland Security has continued to raid workplaces and audit companies to see if they employ undocumented workers. In November Infosys, an Indian IT firm, agreed to pay fines of $34m for immigration offences. Farmers who need lots of pairs of hands to pick things are favourite targets for these checks. Maureen Torrey, a farmer in New York state, says her business has been subjected to aggressive raids by immigration officials. Last year officers turned up at 6.30am and removed 44 workers to check their status. They were eventually dropped off at a 7-Eleven store two hours from the farm.

As the system for tracking people down has become more powerful, there has been a huge increase in the number of plaintiffs appearing before immigration courts. Some 1.1m people are somewhere on the docket: that is nearly 5,000 immigration cases per judge. More than half of all federal prosecutions are now for immigration-related offences. To deal with this overload, courts have sprung up all over the place: close to the border, but also in Michigan, Minnesota, Missouri, Nebraska and New Jersey. They all have the same blue carpets, dark wood benches and American flags, identikit outposts of the Justice Department tucked away unannounced in office buildings.

The system does a good job of giving each plaintiff a decent hearing. One typical day in the San Antonio court featured a Vietnamese woman, married to an American citizen, fighting deportation, a young couple hoping to get married soon, and a man who had a conviction for abandoning a child. The judges were patient and, working through interpreters, did their best to render legalese into plain English. This lent the process a certain dignity, but in most cases the outcome was clear from early on.

In the holding pens

The number of people deported is largely determined by the number of beds available in detention centres, which are the holding pens for the people America expels. Each year Congress mandates funding for a certain number of beds for immigration detention and stipulates that the occupancy rate must be kept high. In 2013 that number was 34,000. The president asks for less funding in his budgets but Congress gives him more, such is the political appeal of spending on border security.

Some of these places are run by private companies for ICE, like the one in Pearsall, a small Texas town decorated with churches, car-parts shops and a high-school football field. The facility can house up to 1,800 men at any one time, sleeping on iron bunk-beds in dormitories of up to 100. This is not a prison but it has few windows, is surrounded by fences topped with razor wire and is run by the GEO Group, a company that also runs prisons.

The Pearsall detention facility is quiet inside, apart from the noise of thick metal doors opening and closing. A manager explains that the colour scheme, mostly khaki, has been carefully chosen to keep the inmates calm. More people spend time in such places in any given year than serve time in federal prisons. Housing them all cost $2 billion in 2012, or nearly $5,000 per person deported.

Even with all this funding, the beds the government is mandated to provide exceed the number of places available in detention facilities, so the excess are housed in ordinary prisons. In other words, they are locked up with ordinary felons. The requirement to keep the beds filled means that as soon as one group of people are deported another arrives to replace them. On the day your correspondent visited the Pearsall detention centre the occupancy rate had dipped to 95%, so the staff were expecting a new delivery of people. The average length of stay in these places before deportation is about a month. Multiply the number of beds by 12 and you get close to the number of people deported each year.

In the Pearsall facility the men wear colour-coded boiler-suits: blue for minor offences, orange for mid-level ones and red for the most serious offenders. The government is keen to focus its efforts on serious criminals, the red boiler-suits, and boot them back over the border. But in the Pearsall detention centre there are a lot of people wearing blue. TRAC, a database maintained by Syracuse University of each case that comes before the courts, shows that just one in seven filings to deport is based on allegations of criminal activity.

The government has to make sure that the countries where detainees were born will have them back. In rare cases this proves impossible. Families for Freedom, an NGO, says it is working with a Kenyan man who has been in immigration detention in New York for eight years. From the detention centres the deportees are rounded up and put on planes. ICE has its own air operations division which flew 44 charter flights a week in 2013, and runs a daily flight to deposit people in Central America. When flying to more unusual destinations, an ICE agent will babysit the deportee on a commercial flight.

This is a remarkable feat of logistics. And yet it could be more extensive. It would take many more years of deportations running at their current level to remove all 11.7m undocumented migrants. Yet most Americans think this is unrealistic, a view shared by those doing the deporting. “You cannot enforce your way out of this problem,” says an ICE official. “Nobody is more convinced of the need for immigration reform than us. Our people want to be doing law enforcement.”

The great expulsion which America is carrying out is removing some people who have committed violent crimes. But it is also expelling economic migrants, some of whom have been working in America for decades, and splitting up families. In the two years to September 2012, 205,000 parents were deported.

Judges do have the discretion to halt a deportation if it will cause extraordinary distress to the family. But in the case of Mr Rochas, the care-home worker, the distress of his wife and children, who face growing up without their father, was of the ordinary variety; and besides, the clemency quota had been filled already.