The photos are horrific.

Images of women, men, and children packed into overcrowded concrete cells and chain-link cages are flashing across cable television news. They were released Tuesday by the US Department of Homeland Security’s internal watchdog, as part of a report describing the “dangerous” conditions at migrant detention centers along the border.

The photos have brought more attention to Rep. Alexandria Ocasio-Cortez’s controversial remark that the US government is operating concentration camps. The White House has responded to criticism by suggesting that Congress is to blame.

“We’ve asked for more bed space, we’ve asked for more support,” Vice President Mike Pence said recently in an interview on CBS. “Our Customs and Border Patrol agents are doing their job, but the system is overwhelmed.”

It doesn’t have to be this way. The Trump administration doesn’t need to lock up asylum seekers and undocumented immigrants to enforce US immigration laws.

Requesting asylum is not against the law, so there’s no legal requirement to jail them like criminals. Under past administrations, the Department of Homeland Security has usually chosen to lock up both asylum seekers and those who cross the border without a visa, but the agency also created several effective alternatives to detention. The White House could prioritize these programs instead of keeping migrants in such inhumane conditions.

One alternative is to release immigrants under community supervision, in which a nonprofit group or government contractor provides families with social workers, who help them find housing and transportation, and who make sure they attend court hearings and comply with the law.

Another alternative is to release immigrants with electronic monitoring, which generally involves placing GPS ankle monitors on adults and assigning them caseworkers.

Until a few years ago, Immigration and Customs Enforcement (ICE) was running two alternative programs at the national level: the Intensive Supervision Appearance Program (ISAP), which involves electronic monitoring, and the less restrictive Family Case Management Program (FCMP), which relied on community monitoring. The administration ended one of the programs and has not expanded the other. The methods used in these programs are available to DHS, and are much cheaper than traditional detention — but the Trump administration is operating as if locking everyone up in squalid conditions is the only way.

Social workers can supervise migrants outside of jail

When someone is arrested for an immigration violation, an ICE or Border Patrol officer has a lot of discretion in deciding whether to book that person in immigration jail or release them while their case makes its way through immigration court. (Immigration judges do not make initial bond decisions the way judges do in the criminal court system.) The decision often comes down to whether the ICE officer thinks that person might commit a crime or skip town.

Since 2013, ICE officers have been using a computer algorithm, called the Risk Classification System, to help them assess whether an immigrant is a danger to the community or a flight risk. They do background checks and search for open warrants, past immigration violations, and gang connections. They also conduct extensive interviews about each person’s ties to the community, job history, and drug use. The algorithm recommends whether or not an immigrant should be detained, but officers aren’t required to follow the recommendation, and they often don’t.

If they choose to release someone, there are several ways to do that. They could issue them a notice to appear in court and trust that they will show up, or release them on bond. They could also release immigrants under community supervision or electronic monitoring.

The Family Case Management Program was launched by the Department of Homeland Security in 2015, in response to the waves of mothers and children seeking asylum from gang violence. Instead of keeping children in detention centers with their parents, families in certain cities were released and monitored by social workers, who helped them find lawyers, housing, and transportation and made sure they attended their court hearings.

It seemed to work pretty well, according to ICE, though officers never had more than 1,600 people enrolled in the program during the two years it existed (compared to more than 350,000 immigrants who were held in ICE detention centers just in 2016).

The contractor that ran the program said that 99 percent of participants “successfully attended their court appearances and ICE check-ins.” That included the 15 families who were ultimately deported.

But in June 2017, after Trump took office, DHS shuttered the program, without explanation, and stopped sending more immigrants to the program. Instead, they’ve chosen to detain people as long as possible. Recent public outcry over conditions at the border camps, as well as the administration’s focus on separating families, has renewed questions about the decision to end the program. Last year, a spokesperson for the agency told Vox that the program was effective, but suggested that the agency had hoped it would lead to more deportations than it did.

Immigration authorities have partnered in the past with nonprofit groups to provide other forms of community supervision, and the compliance rates were also high. A 2012 program with Lutheran Immigration and Refugee Services provided community-based supervision to 240 immigrants whom ICE would normally keep behind bars. It had a 97 percent appearance rate, costing an average of $24 a day. There is nothing stopping the agency from launching new partnerships like these.

Ankle bracelets are another alternative to detention

The Obama administration turned to another detention alternative, which involves ankle bracelets and other forms of electronic monitoring.

Central American mothers and children seeking asylum were released from detention centers in 2016 after a federal judge told DHS it could not keep children detained more than 20 days. In response, DHS ramped up its Intensive Supervision Appearance Program (ISAP), run by a subsidiary of the GEO Group, a Florida-based company that operates private prisons and most of ICE’s detention centers.

ISAP allows caseworkers and immigration officers to track immigrants with GPS ankle monitors linked to a cellphone app. The program also requires regular phone check-ins with authorities using voice recognition software and unannounced home visits.

ISAP has its share of critics, who argue that it’s a burdensome program without clear guidelines. But it also seems effective from ICE’s point of view. The contractor said it led to a 99.6 percent compliance rate for court appearances, though it had a lower compliance rate for deportation orders — 79 percent.

ICE actually wants more alternatives to detention

In its budget request to Congress in May 2017, the Department of Homeland Security said alternative programs (in general) were effective, and led to “strong alien cooperation” and compliance with immigration proceedings. It asked for an extra $57 million to expand electronic monitoring and community supervision programs to 26,000 more detainees.

Congress ended up giving $4.1 billion to ICE for immigration detention and removal operations, which the agency can spend on detention centers or alternative programs. The agency decided to eliminate the Family Case Management Program, and placed 69,000 immigrants into the ISAP electronic monitoring program.

In its budget request for fiscal year 2019, the agency said it’s necessary to continue expanding alternative programs with the limited available bed space in ICE detention centers:

It is critical that ICE have the ability to assign supplemental reporting requirements available under the ATD program for those individuals not subject to mandatory detention and/or not suitable for detention for a variety of reasons. These generally include family units that must be released from detention within a few weeks pursuant to court order as well as individuals with significant medical issues – where delivery of appropriate care would be difficult in a detention setting.

Indefinite detention is very expensive

Electronic monitoring and community supervision are just a couple of the options the Trump administration could prioritize instead of detention. They would also save the US government a ton of money, which is something Republicans say they care about.

To understand just how expensive it is for DHS to house, shelter, and feed immigrants, all you have to do is look at the agency’s own numbers. In its budget request for fiscal year 2018, DHS said that it cost about $133.99 per day to hold an adult immigrant in detention and $319.37 for an individual in family detention. Meanwhile, the agency said the average cost of placing someone in an alternative program is $4.50 per day.

Recent estimates from the Department of Health and Human Services show that housing immigrants in tent cities would cost a whopping $775 a day per detainee, according to documents reviewed this summer by reporters at NBC News.

Immigrant advocacy groups have urged Congress to shift more DHS funding from detention to these alternatives as Trump ramps up border enforcement.

The problem is that the Trump administration isn’t interested in other options. To the president and other immigration hawks, these alternatives to detention represent what they consider the failed “catch and release” policies of the previous administration.

But these programs do work, and they do allow the government to enforce immigration laws effectively. And they are far better than the nightmare of separating families, putting them in tent cities, or keeping them together in overcrowded jails with no end in sight.