WASHINGTON — The Trump administration signed an agreement with Guatemala Friday that will restrict asylum applications to the U.S. from Central America.

The so-called "safe third country" agreement would require migrants, including Salvadorans and Hondurans, who cross into Guatemala on their way to the U.S. to apply for protections in Guatemala instead of at the U.S. border. It could potentially ease the crush of migrants overwhelming the U.S. immigration system, although many questions remain about how the agreement will be executed.

President Donald Trump heralded the concession as a win as he struggles to live up to his campaign promises on immigration.

"This is a very big day," he said. "We have long been working with Guatemala and now we can do it the right way."

He claimed, "This landmark agreement will put the coyotes and smugglers out of business."

The announcement comes after a court in California blocked Trump's most restrictive asylum effort to date, one that would effectively end protections at the southern border.

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.

"We'll either do tariffs or we'll do something. We're looking at something very severe with respect to Guatemala," Trump had said.

On Friday, Trump praised the Guatemalan government, saying now it has "a friend in the United States, instead of an enemy in the United States."

Trump added Friday that the agreement would protect "the rights of those with legitimate claims," end "abuse" of the asylum system and curtail the crisis on the U.S. southern border.

He said that as part of the agreement, the U.S. would increase access to the H-2A visa program for temporary agricultural workers from Guatemala.

It's not clear how the agreement will take effect. Guatemala's Constitutional Court has granted three injunctions preventing its government from entering into a deal without approval of the country's congress.

Guatemalan President Jimmy Morales said via social media that the agreement allows the country to avoid "drastic sanctions ... many of them designed to strongly punish our economy, such as taxes on remittances that our brothers send daily, as well as the imposition of tariffs on our export goods and migratory restrictions."

Earlier Friday, Morales questioned the concept of a "safe third country."

"Where does that term exist?" he asked reporters. "It does not exist, it is a colloquial term. No agreement exists that is called 'safe third country.'"

Human rights prosecutor Jordán Rodas said his team was studying the legality of the agreement and whether Interior Minister Enrique Degenhart had the authority to sign the compact.

Guatemala's government put out a six-paragraph, Spanish-language statement Friday on Twitter. It does not call the agreement "safe third country" but "Cooperation Agreement for the Assessment of Protection Requests."

The Guatemalan government said that in 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 same conditions driving Salvadorans and Hondurans to flee their country — gang violence, poverty, joblessness, a prolonged drought that has severely hit crop yields — are also present in Guatemala. Guatemala also lacks resources to adequately house, educate or provide opportunity to potential asylum seekers, observers say.

Advocacy groups condemned the move Friday, with Amnesty International saying "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.

Democratic Rep. Eliot Engel, the chairman of the House Committee on Foreign Affairs, said Trump's decision to sign the agreement was "cruel and immoral." ''It is also illegal," he added. "Simply put, Guatemala is not a safe country for refugees and asylum seekers, as the law requires."

Homeland Security officials said they expected the agreement to be ratified in Guatemala and would begin implementing it sometime in August. Acting Secretary Kevin McAleenan said it was part of a long-standing effort with Guatemala to address migration and combat smuggling. He cautioned against calling the country unsafe for refugees.

"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 U.S. 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."

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%.

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