QUITO, Ecuador — Ecuador announced Wednesday that it will begin requiring visas for Cubans starting Dec. 1 in an attempt to dissuade Cuban migrants from using the country as a springboard for getting to the United States. The move is the latest in an ongoing diplomatic and humanitarian crisis in which several thousand Cuban migrants are marooned at the Costa Rica-Nicaragua border, hoping to continue their trip north.

Ecuador eliminated visas for all tourists in 2008, setting itself up as a staging ground for migrants from all over the world hoping to reach the U.S. But the recent backlog of Cuban migrants at Costa Rica’s northern border has brought Ecuador’s role into the limelight.

The Ecuadorian government “will require visas of Cuban citizens not because we have something against Cuba,” Deputy Foreign Minister Xavier Lasso said at a news conference Thursday. “On the contrary, you all know about our close and warm ties with the Cuban people.”

Lasso said the government made the decision in order to stop “human rights violations and the risk of losing lives” that comes with the illegal smuggling of Cubans through the Americas to the U.S.

The land route to the U.S. via Ecuador has become increasingly popular with Cuban migrants hoping to reach U.S. soil and gain residency under that country’s generous immigration policy for people leaving the Communist island. Cubans fly to Ecuador then travel by land and air up through South and Central America to the U.S.-Mexico border.

But a recent surge in Cuban migrants using this route has led to a diplomatic standoff in which many Latin American countries, led by Costa Rica, are pushing to create a “humanitarian corridor” for the migrants while Nicaragua, likely backed by its ally Cuba, refuses to participate.

Costa Rica has provided the Cubans with temporary transit visas in the meantime.

Ecuador, for its part, seems to be trying to put the breaks on the Cuban exodus.

“When the situation becomes critical, for example, on the border between Costa Rica and Nicaragua, we have to act. We have to do something,” Lasso said. “And this is the decision the Ecuadorian government has taken: to require visas for Cuban citizens, as an exception, in order to dissuade this flow seeking to get to the United States.”

The diplomat said his government “lamented the incident between Costa Rica and Nicaragua” and said the government was putting the visa requirement in place for Cubans for 90 days. He emphasized that Ecuador’s migration policy “is not repressive” and that “we’re not closing the doors to Cuba.”

Costa Rica President Luis Guillermo Solís thanked Ecuador for the move in a statement on Thursday. He said additional measures to address the Cuban migrant crisis would be announced in the coming days.

Ecuador’s Lasso said his government didn’t have plans to require tourist visas from citizens of any other nationality for the time being.

The number of Cubans arriving in Ecuador has increased dramatically in recent years, Lasso said, from 753 Cubans in January 2014 to 2,502 in January 2015.

He said more than 40,000 Cubans had entered Ecuador since the country stopped requiring visas in 2008.