Donald Trump announced Friday that Guatemala was signing an agreement to restrict asylum applications to the US, a move that immigrant rights advocates said was cruel and unlawful.

The so-called “safe third country” agreement would require migrants, including Salvadorans and Hondurans, who cross into Guatemala on their way to the US to apply for protections in Guatemala instead of at the US border.

It’s not yet clear how the agreement would take effect. Guatemala’s constitutional court has granted three injunctions blocking its government from entering into a deal without approval of the country’s congress.

The announcement came after a court in California blocked Trump’s most restrictive asylum effort to date – one that would have, in effect, ended protections at the southern border.

Human rights groups condemned the latest move on Friday, with Amnesty International saying that “any attempts to force families and individuals fleeing their home countries to seek safety in Guatemala are outrageous”.

“The Trump administration must abandon this cruel and illegal plan to shut doors to families and individuals trying to rebuild their lives in safety,” said Charanya Krishnaswami, the group’s advocacy director for the Americas.

Raices, a Texas-based group that provides legal services to immigrant and refugee families, said the plan would put people’s lives at risk and that the third country agreement “violates the principle of asylum and directly leads to people being kidnapped, beaten and sexually abused”.

The two countries had been negotiating such an agreement for months, and Trump threatened Wednesday to place tariffs or other consequences on Guatemala if it didn’t reach a deal.

Guatemala’s government put out a short Spanish-language statement on Twitter that did not call the agreement “third safe country” but “Cooperation Agreement for the Assessment of Protection Requests”.

The Guatemalan government said that in the coming days its labor ministry “will start issuing work visas in the agriculture industry, which will allow Guatemalans to travel legally to the United States, to avoid being victims of criminal organizations, to work temporarily and then return to Guatemala, which will strengthen family unity”.

The US president claimed it was a “landmark agreement” that would “put the coyotes and smugglers out of business”, adding: “This is a very big day. We have long been working with Guatemala and now we can do it the right way.”

Democrats criticized the decision on Friday. Congresswoman Norma Torres said “the Guatemalan government has chosen to defy the will of its own people to curry favor with the Trump administration” and called the move an “an insult to common sense”.

Congressman Eliot Engel, the chairman of the House committee on foreign affairs, said Trump’s decision to sign the agreement was “immoral” and “illegal”, adding: “Simply put, Guatemala is not a safe country for refugees and asylum seekers, as the law requires.”

Department of Homeland Security officials said they expected the agreement to be ratified in Guatemala and would begin implementing it sometime in August. Kevin McAleenan, the acting secretary, said it was part of a long-standing effort with Guatemala to address migration and combat smuggling.

“It’s risky to label an entire country as unsafe. We often paint Central America with a very broad brush,” he said. “There are obviously places in Guatemala and in the US that are dangerous, but that doesn’t mean it doesn’t have a full and fair process. That’s what the statute is focused on. It doesn’t mean safety from all risks.”

Some noted that the US state department’s own advisory on Guatemala says that “violent crime, such as armed robbery and murder, is common” and that “Gang activity, such as extortion, violent street crime, and narcotics trafficking, is widespread”.

Guatemalans accounted for 34% of border patrol arrests on the Mexican border from October to June, more than any other nationality. Hondurans were second at 30%, followed by Mexicans at 18% and Salvadorans at 10%.

Out of 259 asylum applications that Guatemala received last year, not a single application was approved, according to the Washington Post.

Trump was asked if he expected to reach similar agreements with Honduras and El Salvador. He replied, “I do indeed.”