While the national conversation was dominated by former Special Counsel Robert Mueller’s testimony before Congress this week, the Trump Administration’s immigration agenda was thwarted on several fronts.

A federal judge in San Francisco issued a nationwide preliminary injunction Wednesday night against a new Trump Administration rule that would have barred most migrants from Guatemala, El Salvador and Honduras from applying for asylum in the United States. Separately, the Ninth Circuit Court of Appeals on Monday ruled against a Trump Administration policy that permitted indefinite detentions in some cases (the ruling also halted a lower court’s order that would have limited the number of days for which asylum seekers could be detained.) Outside of the U.S. judicial system, both Mexico and Guatemala indicated that they will not take responsibility for asylum seekers who pass through on their way to the U.S.

The Trump Administration is seeking ways around each setback, announcing its intention to fight the legal challenges and using measures including tariff threats to pressure Mexico and Guatemala to reduce the flow of migrants. The border crisis continues to overwhelm the system, and there are currently tens of thousands of migrants being held in overcrowded and unsanitary conditions in U.S. immigration detention centers.

The American legal system puts policies in flux

In response to Wednesday’s preliminary injunction on the asylum rule, the White House said in a Thursday statement that it would “pursue all available options to address this meritless ruling.”

The statement also noted that the injunction came “despite a ruling from another federal judge earlier in the day rejecting the same request by other plaintiffs,” referring to a ruling from U.S. District Judge Timothy Kelly, a Trump appointee. (The San Francisco judge, Jon S. Tigar, was appointed by the Obama Administration.) The White House also lamented “the tyranny of a dysfunctional system” that it alleges allows plaintiffs to “forum shop in order to find a single district judge who will purport to dictate immigration policy to the entire Nation.” Trump has frequently criticized the courts and what he has labeled “Obama judges,” including after a previous ruling from Tigar ordering an injunction on an asylum ban in 2018.

In addition to the asylum ruling, the Ninth Circuit on Monday declared unconstitutional an order from Attorney General William Barr earlier this year that said some asylum-seekers weren’t eligible for bond hearings. But the appeals court also struck down a lower court decision that would have set time limits on releasing asylum-seekers. “We are pleased that the Ninth Circuit partially granted the government’s stay application in this case pending further appeal,” said White House deputy press secretary Steven Groves, while calling the move to. “Unfortunately, in the same decision, the Ninth Circuit also allowed a radical decision from a district judge to go into effect during the pendency of the government’s appeal … we strongly disagree with that decision.”

The Guatemalan legal system disrupts Trump’s deal

The new asylum policy was announced last Monday, a day after U.S.-Guatemala talks on changing asylum rules fell apart. On July 14, Guatemala’s highest court denied President Jimmy Morales the authority to sign the deal, and he canceled a trip to Washington. On July 23, Trump retaliated by threatening Guatemala with tariffs and remittance fees, as well as an unspecified immigration “ban.”

In response, Guatemala’s foreign minister said on Twitter that the deal’s domestic critics would be responsible for the potential tariffs and remittance fees. Guatemala’s president, Jimmy Morales, blamed the country’s highest court in a Facebook post on Tuesday, writing, “the repercussions of the government of the United States of America on Guatemala are the result of a series of counterproductive actions of the Constitutional Court.”

Morales, a former television personality, had portrayed himself as an outsider candidate and reformer while running for president — but once in office, he joined efforts to dismantle a United Nations-backed anti-corruption panel.

Earlier this year, the Trump administration cut hundreds of millions of dollars in aid to Guatemala, El Salvador, and Honduras. Taxes or fees on remittances, which account for 12.1% of the country’s GDP, much of it from the U.S., could further damage Guatemala’s economy.

“Guatemala gave us their word,” Trump said on Wednesday. “We were going to sign a safe third agreement and then, all of a sudden, they backed up.”

The derailed deal, known as a “safe third country” agreement, would have designated Guatemala as a “safe” place for people fleeing El Salvador and Honduras in which to seek asylum. In theory, if the U.S. secures agreements that compel people to seek asylum in the first “safe” country they pass into, it could force migrants to claim asylum in countries like Guatemala and Mexico — thereby stemming the migrant crisis at the U.S.-Mexico border.

But critics argue that neither Guatemala nor Mexico will able to guarantee safety for asylum seekers.

Although Guatemala’s homicide rate has fallen in recent years, it remains the 14th-highest in the world. The U.S. State Department warns that “violent crime, such as armed robbery and murder, is common” in Guatemala. “Gang activity, such as extortion, violent street crime, and narcotics trafficking, is widespread. Local police may lack the resources to respond effectively to serious criminal incidents,” the State Department’s travel advisory says.

“It’s clear that Guatemala is not a safe country for Guatemalans, let alone for anyone else,” Anita Isaacs, a fellow at the Wilson Center who has consulted the State Department on corruption and organized crime in Central America, told TIME last week.

Read More: ‘Do Not Travel Due to Crime and Kidnapping.’ Here’s Where the U.S. Is Sending Asylum Seekers

Mexico refuses safe third country

A similar threat of tariffs brought Mexico to the negotiating table in June. To avert tariffs, Mexico agreed to step up immigration enforcement, accept migrants waiting for their U.S. asylum claims to be processed, and revisit asylum rules on July 22 if the first two measures had “not sufficiently achieved results in addressing the flow of migrants to the southern border of the United States.”

That deadline passed on Monday. Secretary of State Mike Pompeo was in Mexico City over the preceding weekend for negotiations with Mexican Foreign Minister Marcelo Ebrard ahead of the deadline. After the negotiations, Mexico said it refused to discuss a safe third country agreement with Pompeo.

The unraveling of the anticipated deal with Guatemala may have made negotiations with Mexico more difficult for Pompeo. “If Mexico sees Guatemala as no longer being a player in this regional asylum burden-sharing agreement, Mexico might be much more hesitant to jump in,” Sarah Pierce, a policy analyst at the Migration Policy Institute, told TIME last week.

Although the Trump Administration’s long-sought safe third country agreement appears to be off the table for now, there are indications that Mexico is taking steps to continue to expand the “Remain in Mexico” program, as it agreed to do in June. Under that program, formally known as the “Migrant Protection Protocols,” migrants applying for U.S. asylum wait in Mexico while their claims are being processed. So far, the “Remain in Mexico” program has already moved more than 20,000 asylum seekers from Central America. This week, Mexican officials announced that they will open a shelter in Tijuana that will hold 4,000 asylum seekers. Currently, the wait can be up to several months long, according to Pierce, with some applicants being assigned court dates “well into 2020.”

In addition to expanding Remain in Mexico, Ebrard emphasized at a news conference on Monday that the number of migrants at the U.S. southern border has decreased by 36% since January. In June, under Trump’s threat of tariffs, Mexico agreed to increase enforcement at its borders with both Guatemala and the U.S. Although border apprehensions typically decrease as the weather gets hotter, border apprehensions by the Department of Homeland Security dropped by 28% this June, a sharper decline relative to last year’s 11% decrease. Trump said on Wednesday that Mexico “will probably put up more” troops.

Trump also seemed to indicate that he believed his tariff threat had achieved results at the border by spurring increased enforcement from Mexico. “The numbers are way down at the border, which is a good thing,” he said. “Apprehensions are way down because Mexico has now 22,000 soldiers. And they mean business because they know what happens; the alternative is not good for them.”

At the same time, he also reiterated his threat of tariffs against Guatemala. “We’ll either do tariffs or we’ll do something,” he said. “We’re looking at something very severe with respect to Guatemala.”

Contact us at letters@time.com.