SAN SALVADOR, El Salvador — Central American officials met with their counterparts from Ecuador, Colombia and Cuba Tuesday to deal with the problem of thousands of Cuban migrants stranded in Costa Rica.

The migrants have started using an overland route to reach the United States by traveling to Ecuador, then through Central America and Mexico.

That has sparked tensions in Central America, with Nicaragua accusing its southern neighbor Costa Rica on Tuesday of “unleashing an invasion of illegal Cuban migrants” on Nicaragua.

“Our governments do not have the resources to deal with this new threat to our national security,” the Nicaraguan government said in a statement, suggesting that the wave could facilitate terrorism or migrants from other countries.

Nicaragua’s leftist government has warm ties with Cuba.

On Nov. 13 Costa Rica allowed Cubans to transit the country to Nicaragua. Nicaragua dispatched soldiers to the border to block the Cubans’ passage, setting off minor clashes at the Penas Blancas crossing on Nov. 15.

The dispute has left some 2,000 Cubans stranded in shelters in Guanacaste province on the Nicaraguan border.