In pressuring Guatemala to accept a deal to absorb vast numbers of asylum-seekers, the Trump administration has embarked on a dramatic and risky strategy to slash the number of Central Americans flooding the US-Mexico border.

The accord – which was negotiated in secret and signed at the White House on Friday – could plunge Guatemala’s young democracy into a constitutional crisis, analysts warn.

It could also saddle one of the hemisphere’s poorest countries with tens of thousands of Salvadoran and Honduran migrants who would be barred from making their claims in the United States.

The agreement is one of the boldest steps yet taken by Donald Trump to stanch the flow of migrants to the US border.

It aims to close off the US asylum system to the migrants who have crossed through Guatemala en route to the United States. They would instead have to seek protection in Guatemala.

Guatemala's bloody battle with Mexican drug cartels Show all 6 1 /6 Guatemala's bloody battle with Mexican drug cartels Guatemala's bloody battle with Mexican drug cartels 24-Mexico Main.jpg Police arrest four suspected members of the Los Zetas gang in Coban Getty Images Guatemala's bloody battle with Mexican drug cartels 24-Mexico-2.jpg Residents at a crime scene in Guatemala City on Thursday AP Guatemala's bloody battle with Mexican drug cartels 24-Mexico-3.jpg Police remove a body in the capital AP Guatemala's bloody battle with Mexican drug cartels 24-Mexico-4.jpg Street vendors protest against the violence Reuters Guatemala's bloody battle with Mexican drug cartels 24-Mexico-5.jpg Manuel Baldizon: The little-known congressman came from nowhere to finish second in the first round of elections in September, talking 23 per cent of the vote to Molina's 36 per cent Reuters Guatemala's bloody battle with Mexican drug cartels 24-Mexico-6.jpg Otto Perez Molina: A silver-haired former army general, Molina stood unsuccessfully for the presidency in 2007, but has since become favourite to win the current presidential election EPA

But the agreement is built on a fragile political and legal base.

Guatemala’s constitutional court ruled earlier this month that President Jimmy Morales needed approval from the Guatemalan Congress to sign the accord – something he has not received.

The Guatemalan president has sharply criticised the court decision, saying on Friday that “as far as we understand, this doesn’t have to go before Congress”.

Some analysts said Mr Morales could get around the ruling with his argument that the deal is simply a cooperation agreement, not a treaty. But others note Mr Morales has at times simply shrugged off court rulings he dislikes.

“This leaves a legacy we won’t be able to recover from, that the country’s constitution can be flagrantly violated without any kind of reaction or penalty,” said Renzo Rosal, an independent political consultant.

The agreement is also likely to be challenged in US courts by opponents who say that Guatemala does not qualify as a “safe” country, because of high levels of violence.

Whatever happens with the courts, the agreement has little political support in Guatemala.

Mr Morales, who finishes his four-year term in January, is highly unpopular.

Among the top Twitter hashtags in Guatemala in recent days has been #Jimmyvendepatrias – Jimmy the sellout – as a dig at the country’s leader.

Honduran migrants travelling through Guatemala hitching their way toward the United States

Guatemalans were startled by a widely published photo showing their government minister, Enrique Degenhart, signing the agreement as Mr Trump loomed over his shoulder, an image suggesting the Central American country’s submission.

On Saturday, hundreds of people demonstrated in front of the presidential palace in Guatemala City to protest the agreement, the Associated Press reported. The protesters carried Guatemalan flags and called for Mr Morales’ resignation.

Guatemalan analysts have suggested Mr Morales made the deal with Mr Trump in hopes of winning support from the US government.

Mr Morales faces allegations of financial crimes related to his 2015 electoral campaign but has been shielded by presidential immunity, which he loses in January. He says he is innocent.

Mr Morales said the agreement would help Guatemala by “putting us in a privileged position” with the country’s top trading partner and most important ally.

Guatemala holds a run-off presidential election on 11 August, and both candidates have criticised Mr Morales’ negotiation of such a broad agreement in secret.

The accord “is unlikely to be sustainable”, Stephen McFarland, a former US ambassador to Guatemala, wrote in a tweet on the eve of the agreement’s unveiling.

“A bitter US ‘win’ would put at risk US goals in democracy and law enforcement with the current and next governments.”

While the next Guatemalan government could cancel the agreement, it would face intense pressure from the Trump administration to not do so.

Mr Morales’ government signed the pact after Mr Trump threatened severe penalties on Guatemala – tariffs, a travel ban or taxes on the billions of dollars in remittances sent home by migrants in the United States.

Support free-thinking journalism and attend Independent events

Kevin McAleenan, the acting Homeland Security secretary, said the administration plans to start the “safe third country” programme with Guatemala in August.

Human rights groups, Democratic lawmakers and immigration experts have said Guatemala is too poor and underdeveloped to handle a flood of asylum applicants.

Last year, Salvadoran and Honduran migrants filed nearly 58,000 applications for asylum in the United States. That same year, Guatemala received just 259 asylum applications overall.

Guatemala is the number one source of irregular migration to the United States, with citizens fleeing poverty, violence, low coffee prices and drought.

Eric Schwartz, head of Refugees International and a former top refugee official at the US State Department, said in a statement that the agreement “would represent a grotesque violation of both US law and human decency” and “would put at risk the lives of thousands of Central Americans”.

Sonia Lucia Valenzuela, a constitutional law expert in Guatemala, said the Constitutional Court ruling was clear in instructing Mr Morales to send the agreement to Congress but that political pressures could determine what happens next.

The migration agreement has been strongly supported by Guatemala’s influential business groups, who had feared US tariffs. But many current and former politicians oppose it.

“If the opposition to this accord continues, that’s a sign this will escalate,” she said.