Nicaragua has turned back hundreds of Cuban migrants which it accuses of "storming" its border crossing from neighbouring Costa Rica on Sunday.
The Cubans are travelling north, trying to reach the United States by land.
They fear that with ties between Cuba and the US improving, the US could stop granting Cubans who reach the US by land the right to stay.
Nicaragua accused Costa Rica of "hurling thousands of Cubans at Nicaragua's southern border posts".
The Cubans said they had flown to Ecuador from where they had made their way north through Colombia and Panama to Costa Rica.
They reported being stranded in Costa Rica after the trafficking ring which they had paid to get them to the US was broken up by the authorities.
On Saturday, Costa Rica issued seven-day transit visas to more than 1,700 Cubans detained after crossing illegally into Costa Rica from Panama.
Nicaragua's left-wing government, which has close ties to Cuba, said that move had "unleashed a humanitarian crisis with serious consequences for our region".
The Cubans told Nicaraguan media they had waited for hours to be granted Nicaraguan transit permits before getting impatient and entering the Penas Blancas border post by force.
They continued on foot on the Panamerican Highway north, where they were met by Nicaraguan security forces who took them back to Costa Rica.
Some migrants said Nicaraguan security forces had fired tear gas and rubber bullets.
Costa Rican Foreign Minister Manuel Gonzalez criticised Nicaragua's response.
"When other countries take the irresponsible decision to close their borders, people will use any means to reach their destination," he said.
One Cuban migrant told Nicaraguan newspaper El Nuevo Diario that "most of us have been travelling for more than two months".
"We're fleeing unemployment [in Cuba] and among this group, which started gathering in the past days in Costa Rica, are children and pregnant women," the 50-year-old migrant said.
Another migrant told Reuters news agency that "we don't want to stay in any of these countries, our aim is to reach the United States, that's our objective".
The number of Cubans leaving the Communist-run island has risen since last December when Cuba and the US announced a thaw in their relations.
Historically, Cubans reaching US soil have been given preferential treatment over migrants from other countries.
Under the 1966 Cuban Adjustment Act, they can be granted asylum much more easily than applicants from other countries.
But with relations between the former Cold War foes improving, many Cubans fear this policy, which dates back to the Cold War, could be abolished.
According to US Customs and Border Protection figures, more than 25,000 Cubans entered the US through its southern border between October 2014 and September 2015.